-->
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: Filtering collection elements when loading
PostPosted: Mon Nov 14, 2005 1:46 pm 
Beginner
Beginner

Joined: Sat May 07, 2005 12:01 pm
Posts: 33
Hi,

Is there a way to filter the child objects when a collection is loaded? For example, instead of deleting objects from a database, we mark them with a "Deleted" flag. Of course, there is no way for Hibernate to know about this, so all child objects (active and deleted) are included in collections.
How can I prevent specific objects from being loaded into collections? I looked at the obvious Interceptor and LoadEventListener, but they don't seem to offer this capability.

Thanks a lot!

Jennifer


Top
 Profile  
 
 Post subject: where
PostPosted: Mon Nov 14, 2005 8:18 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
there is "where" attribute on collection mapping that allows this type of filtering, for example
where="deleted=0"

http://www.hibernate.org/hib_docs/v3/re ... ns-mapping

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.