| Hi, 
 I am using a session with flush mode NEVER (FLUSHMODE.NEVER) in other words , a read only session. I am creating an instance of a Class A and saving it in the session. But when i use createCriteria in that read only session , the returned list is always empty. I can open a transaction as i can operate only on a read only session. I am using postgresql as the database.
 I was able to retrieve the specified object using session.get() .  Within a transaction , the same createCriteria works fine.
 
 Is there a way to retrieve objects saved in the session using createCriteria without using a transaction ?.
 
 
 Session session = openReadOnlySession()
 
 
 // Transaction will not be opened
 A a = new A();
 
 Serializable id = session.save(a)
 
 System.out.println("Object will be retrieved"+session.get(A.class,id));
 
 
 
 System.out.println("Object is not getting retrieved"+session.createCriteria(A.class).list());
 
 session.close();
 
 Thanks in advance
 Jothi
 
 
 |