-->
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.  [ 5 posts ] 
Author Message
 Post subject: criteria.list() after deserialized?
PostPosted: Tue Nov 29, 2005 10:37 pm 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
From javadoc, Criteria impl is serializable.
A criteria is created from session.
Can I call criteria.list() after the criteria is serialized and then deserialized?

If not, how can use the same criteria in a new session?

Thanks,
dave


Top
 Profile  
 
 Post subject: Re: criteria.list() after deserialized?
PostPosted: Wed Nov 30, 2005 3:10 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
javatwo wrote:
Can I call criteria.list() after the criteria is serialized and then deserialized?


What happened when you tried this?


Top
 Profile  
 
 Post subject: Re: criteria.list() after deserialized?
PostPosted: Wed Nov 30, 2005 4:20 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
javatwo wrote:
From javadoc, Criteria impl is serializable.
If not, how can use the same criteria in a new session?

Use DetachedCriteria ;)

Code:
DetachedCriteria detCrit = DetachedCriteria.createCriteria(Object.class);

// serialize DetachedCriteria
//------------------------------
// open new session here and deserialize DetachedCriteria

Criteria crit = detCrit.getExecutableCriteria(session);
// etc.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 4:21 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
oops.
Code:
DetachedCriteria detCrit = DetachedCriteria.createCriteria(Object.class);

should be:
Code:
DetachedCriteria detCrit = DetachedCriteria.forClass(Object.class);

:)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 4:31 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
Thanks, very helpful.

for
DetachedCriteria.forEntityName(String entityName)

What is the entityName? how is it related to forClass(Class clazz)?
Is there a way to check clazz?

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.