-->
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: Childs-Auflistung mit Kriterium
PostPosted: Fri Jun 10, 2005 11:07 am 
Newbie

Joined: Tue May 24, 2005 9:30 am
Posts: 3
Hibernate version: 3.0.3

In einer Parent/Child-Beziehung kommt man im Parent einfach an die Childs-Auflistung mit
Code:
   /**
    * @hibernate.set
    *      ...
    * @hibernate.collection-key
    *      column="childId"
    * @hibernate.collection-one-to-many
    *       class="...Child"
    */
   private Set getChilds() {
      return this.childs;
   }


Nun soll aber die Menge einzulesender Childs eingeschränkt werden auf ein Kriterium, ungefähr so:
Code:
   /**
    * @hibernate.set
    *      ...
    *      WHERE="FLD = PARM"
    * @hibernate.collection-key
    *      column="childId"
    * @hibernate.collection-one-to-many
    *       class="...Child"
    */
   private Set getSomeChilds( long PARM ) {
      return this.childs;
   }


(Man könnte natürlich die Childs erst einlesen und dann filtern, aber :(( ... )
Wie geht das?

Vielen Dank


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 6:58 pm 
Beginner
Beginner

Joined: Wed Dec 31, 2003 1:40 pm
Posts: 25
Man kann collection queries benutzen. Etwa so:

createQuery(thing.getChildren(), /HQL/)

irgendsowas. Entweder mit HQL oder mit Criteria queries. Es ist nicht schwer. sieh Dir mal die API JavaDoc seiten an, dann findest Du's.

-Gunther


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.