-->
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.  [ 4 posts ] 
Author Message
 Post subject: [Hibernate 3]session.find
PostPosted: Mon Apr 18, 2005 12:20 pm 
Newbie

Joined: Mon Apr 18, 2005 12:11 pm
Posts: 2
with hibernate 2 , i used
Code:
Iterator itr  = session.find(query.toString()).iterator();

the equivalent with hibernate 3 is also
Code:
Iterator itr  = session.createQuery(query.toString()).list().iterator();


But now, i used too
Code:
Iterator itr  = session.find(query.toString(), values, types).iterator();

I' would like to know the equivalent with hibernate 3, because this method has disappeared in hibernate 3 ...

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 18, 2005 1:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Code:
Iterator itr  = session.createQuery( query.toString() )
        .setXXX( paramName1, paramValue1 )
        .setXXX( paramNameN, paramValueN )
        .list()
        .iterator();


which setXXX() depends on what is in your values and types.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 18, 2005 4:59 pm 
Newbie

Joined: Mon Apr 18, 2005 12:11 pm
Posts: 2
Thanks steeve,

last question, is there a difference between
Code:
Iterator itr  = session.createQuery( query.toString() )
        .setXXX( paramName1, paramValue1 )
        .list()
        .iterator();

and
Code:
Iterator itr  = session.createQuery( query.toString() )
        .setXXX( paramName1, paramValue1 )
        .iterate();

?[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 2:11 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the list() javadoc and iterate() javadoc. There is an explaination of the difference.

_________________
Emmanuel


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