I have a small system consisting of a .net client and a java web service.
The .net client inserts an object into the database, and then calls the web service. The web service tries to retrieve this object using hibernate. First time it works fine, but every other time it says that there is no object with the given identifier.
I have checked the database manually and the row is indeed there! (I debugged the web service and checked for the row even before a session was opened).
SOLUTION
Added this to the hibernate config file
<property name="connection.isolation">1</property>
Here's what I've tried so far:
- The second level cache is disabled
- Added .setCacheMode(CacheMode.REFRESH)
Here's the failing code:
Session session = Program.HibernateUtil.getSessionFactory().openSession();
try
{
return (Alert)session.load(Alert.class, id);
} ...