-->
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.  [ 2 posts ] 
Author Message
 Post subject: Equivalent of SQL in
PostPosted: Mon Jun 27, 2005 5:32 pm 
Newbie

Joined: Tue May 31, 2005 12:54 pm
Posts: 5
Location: New Jersey, USA
Hi all,

I have to locate all documents in the database for a Set of owners. Each document is defined to have a many-to-one mapping to an Owner object. Now, can I specify the owner set in the query param ?

Code:

Query query = session.createQuery("from DSDocument doc where doc.owner in   :ownerSet");
Set<Owner> ownerSet = getOwnerSet();
query.setParameter("ownerSet", ownerSet); // Or query.setEntity()
List list = query.list();


Hibernate version: 3.0.5

Name and version of the database you are using: DB2 v7.0 for O/S 390

Code:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 27, 2005 7:42 pm 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
For setting a collection, use

Code:
query.setParameterList(String name, Collection values);


By the way, you'll also find this in the documentation.

Best regards
Sven


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