-->
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.  [ 1 post ] 
Author Message
 Post subject: Using createCriteria in Read Only Session
PostPosted: Thu Feb 15, 2007 7:10 am 
Newbie

Joined: Mon Dec 11, 2006 1:06 am
Posts: 5
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


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

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.