File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Products » JForum
Bookmark "About topic_last_post_id" Watch "About topic_last_post_id" New topic

About topic_last_post_id

Migrated From
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424

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 by qiucx]
Migrated From
Ranch Hand

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

[originally posted on by Rafael Steil]
I agree. Here's the link:
subject: About topic_last_post_id
It's not a secret anymore!