[jboss-user] [JBoss Seam] - Right way of querying a collection

thierry.rietsch do-not-reply at jboss.com
Mon May 28 12:39:03 EDT 2007


Hi all

I try to get part of a collection over eql (or whatever the ejb query language is called). In the Hibernate tutorial it is suggested to use the criterias to get the data from a collection. As we are using JBoss Seam framework we would like to solve this problem directly over eql.


  | @Entity
  | // ...
  | class SoftwareInventoryObject {
  |   // other code
  |   String name;
  | 
  |   @OneToMany
  |   List<SoftwareInventoryObjectPart> parts;
  | 
  |   // Getter & Setter
  | }
  | 
  | @Entity
  | class SoftwareInventoryObjectPart {
  |   // other code
  |   String name;
  |   // other code
  | }
  | 
My first try was to get the SoftwareInventoryObject over this query:
"from SoftwareInventoryObject sio where sio.name = 'foo' and sio.parts.name = 'bar'". Unfortunately this returned always a SoftwareInventoryObject with all related SoftwareInventoryObjectParts. How do I get only a part of this collection?

Thank you very much for your help,

Thierry


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049088#4049088

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049088



More information about the jboss-user mailing list