-->
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.  [ 3 posts ] 
Author Message
 Post subject: getting leftside of a m-to-m based on property of rightside?
PostPosted: Wed Jul 20, 2005 11:56 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 11:21 am
Posts: 23
Location: erie, pa
I have:
Table A joined to table B in a many-to-many via table AB.
I have these mapped to class A and class B with both ends having a <bag> of the other, called AList and BList.

Basically, what I want to do is:
select A where B.Property = param

I am trying to do this via...
...Add(Expression.Eq("BList.Property", param))

which ends up raising the exception...

NHibernate.QueryException: could not resolve property:BList.Property of :MyApp.A []

Source File: ...NHibernate\src\NHibernate\Persister\AbstractPropertyMapping.cs Line: 45


Which I believe means its looking for "Property" on the array, when what I want is for it to match on Property on the item in the array. I think I am not understanding a concept here. The documentation and example apps I looked at didn't have an example of how I would do this. Can I do this with the Expressions or do I need to write a query? Any help?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 12:52 pm 
Beginner
Beginner

Joined: Tue Jul 19, 2005 11:21 am
Posts: 23
Location: erie, pa
I haven't found a solution using expressions but using a query I can do this...

"select distinct elements(b.AList) from B as b where b.Property = ?"

The elements() function is firetrucking awesome!!!

EDIT: Added the DISTINCT keyword. Its the difference between getting back a couple records or a couple thousand (duplicates). :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 4:45 am 
I have the same requirement -- anyone found a solution yet?


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