-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: the session cache is making mistakes
PostPosted: Tue Apr 24, 2007 5:02 pm 
Newbie

Joined: Fri Oct 07, 2005 11:53 am
Posts: 9
Hibernate version: 3
Name and version of the database you are using: Mysql 5.0

I'm not using any type of cache.

I update an object and on the database the update is ok but hibernate load it with the last status before the changed.

If I try to re-load the object again the object is loaded with the correct status, If I try again to re-load maybe it will be loaded with the correct status or not.. ?¿¡

I thing the problem is here:
Code:
DEBUG org.hibernate.event.def.DefaultLoadEventListener(244) - entity found in session cache


This way is how I open and close the Hibernate sessions:
Code:
Session s = SessionFactory.openSession();
session.beginTransaction();

... the update ...

session.getTransaction().commit();


I don't use ehcache.. not lazy loads..

What is happening?

Thanks.
d2clon


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 10:24 am 
Newbie

Joined: Fri Oct 07, 2005 11:53 am
Posts: 9
I solved the problem adding a session.close() to the sequence

Code:
Session s = SessionFactory.openSession();
session.beginTransaction();

... the update ...

session.getTransaction().commit();
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 5:28 pm 
Beginner
Beginner

Joined: Mon May 21, 2007 5:22 pm
Posts: 27
Location: Salt Lake City
great !!

Thumb rule, always close session if your are opening.

_________________
Try 'N' Enjoy !!
Rahul

If helpful do rating ....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.