Hibernate version: 3.2
Struts 1.3.5
Hi there,
I want to ask something about struts and hibernate. Here i have some code to update my data. It would be like this:
Code:
public void updateTopicReply(Integer id,Integer reply) {
Topic topic = null;
Session session = null;
Transaction tx = null;
session = HibernateSessionFactory.currentSession();
reply=reply+1;
topic = (Topic) session.get(Topic.class, id);
topic.setReply(reply);
tx = session.beginTransaction();
session.update(topic);
tx.commit();
session.close();
}
when i saw it again in my jsp, no its not changed. But when I press F5, yeaaaa, it's been updated.
But when i press F5 again, it changed back again. And I keep press F5, it's just like the lamp of a christmas tree...
So i read some more and I try to add this flush() and refresh()
Code:
...
tx = session.beginTransaction();
session.update(topic);
session.flush();
session.refresh(topic);
tx.commit();
...
But, man.It's still the same.
Anyone know what is the problem?
Any idea or solution u can share?
Or any other method to give?