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: Is this possible?
PostPosted: Mon Jun 04, 2007 8:55 pm 
Newbie

Joined: Mon Jun 04, 2007 8:44 pm
Posts: 8
I have 3 models:

Person * --- 1 Membership 1 -- * Group

I have mapped all three objects (ie. not using many-many).

Now i'm doing "logical delete" or "soft delete" i've seen it referred to, on the Group model. Is it possible to only fetch the non-deleted Groups by association from the Person object?

Ideally i'd like to have the Person.Memberships collection lazily loaded, but if I load in the Memberships collection, i'd like to eager fetch the groups with a where clause filtering out the deleted groups.

Can this only be achieved by a query?

Thanks,

Dave Newman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 13, 2007 1:42 am 
Newbie

Joined: Mon Jun 04, 2007 8:44 pm
Posts: 8
I've realised what i'm after is very similar to Ruby on Rails' Active Record has_many through construct:

eg.
has_many :groups, :through => :memberships

you can then add a where clause on the groups table. Is this supported?

If not, I might look into adding support for it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 13, 2007 3:47 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
I think you can possibly do this using the new "filters" feature of NHibernate 1.2. Haven't tried it myself tho.

Symon.


Top
 Profile  
 
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.