This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JForum and the fly likes About topic_last_post_id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "About topic_last_post_id" Watch "About topic_last_post_id" New topic
Author

About topic_last_post_id

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hi:

i used to create a topic, and in that recorder, the topic_last_post_id is zero, surely i got its new topic id. Following i create a new post and user for the new topic. They are fine.

Next, i want to get the topic via "Topic topic = dataAccessDriver.newTopicDAO().selectById(topicId);", but i failed.
Checking the sql : SELECT t.*, p.user_id AS last_user_id, p.post_time, p.attach AS attach FROM jforum_topics t, jforum_posts p WHERE t.topic_id = 17 AND p.post_id = t.topic_last_post_id

i find topic_last_post_id is still zero. I am wondering that we should update the topic_last_post_id for topic when we create a new post.

Any help will be appreciated.
[originally posted on jforum.net by qiucx]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
After adding the post, you have to update jforum_topics with the generated post_id

Rafael
[originally posted on jforum.net by Rafael Steil]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: About topic_last_post_id
 
Similar Threads
how to store an image into the DataBase using oracle database
How can I show more rencent topics?
Archiving existing yahoo group to JForum
Bizarre problem with validation in Struts 2
create Topic (or forum and post)