-->
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: Loading objects that meet multiple many-to-many-associations
PostPosted: Wed Feb 13, 2008 6:31 am 
Newbie

Joined: Mon Aug 29, 2005 5:21 am
Posts: 9
Hi,
I just ran in a problem to load an object that has multiple many-to-many associations. A part of the mapping of the object Restaurant looks like:

Code:
...
<bag name="Kuechenarten" table="Restaurant_Kuechenart" cascade="all-delete-orphan" inverse="false">
  <key>
    <column name= "`RestaurantID`" />
  </key>
  <many-to-many class="Kuechenart" fetch="join" >
    <column name= "`KuechenartID`" />
  </many-to-many>
</bag>
...


("Kuechenart" means something like Cuisine ot style of food. )

Now I want to get all Restaurant objects that have multiple Kuechenarten, i.e. all Restaurants that offer all Cuisines that I'd like to have.

To get just one of many Kuechenarten is no problem (NHibernate/C#):
Code:
ICriteria _criteria = Session.CreateCriteria(typeof(Restaurant),"Restaurant");
criteria.CreateCriteria("Kuechenarten").
                    Add(Expression.In("KuechenartID", kuechenartenIDs)).SetResultTransformer(CriteriaUtil.DistinctRootEntity);


but I don't have an idea how to get all Restaurants that match all Kuechenarten with (N)Hibernate.

As I think there is no difference in an Hibernate and NHibernate solution I ask in the Hibernate forum.

Thanks,
silveraxe


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 15, 2008 7:49 am 
Newbie

Joined: Mon Aug 29, 2005 5:21 am
Posts: 9
Hi,
anybody an idea how to solve this issue?

Thanks,
silveraxe


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.