-->
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: Collection filtering with condition on related entity
PostPosted: Thu Feb 09, 2012 11:20 am 
Newbie

Joined: Thu Feb 09, 2012 10:07 am
Posts: 1
Hello,

We tried the following things:
- Dynamic filter (session.enableFilter(...))
- Filtering collection (session.createFilter(...))

The problem is that the filter condition is not on an attribute of the entity of the collection but on a related entity.
Here is what is meant
For instance, we have 3 entities Land, Address and BusinessCase.
They relate to each other in this way (cardinality in brackets)
Land(1) -> (*)Address(*) -> (1)BusinessCase

We want to filter the Addresses of Land based on a condition that requires an attribute of BusinessCase.

A solution with a subselect in the condition is not acceptable because the relation between Address and BusinessCase is defined with fetch mode 'join' in the hbm file and this will result in 2 accesses to the BusinessCase table.
The question therefore is how to write a filter condition involving a relation?


Top
 Profile  
 
 Post subject: Re: Collection filtering with condition on related entity
PostPosted: Thu Feb 09, 2012 8:24 pm 
Newbie

Joined: Mon Aug 15, 2005 9:19 pm
Posts: 8
I don't have a solution to your problem. I posted the same issue yesterday https://forum.hibernate.org/viewtopic.php?f=1&t=1014388

The only thing I could find about it was this old JIRA issue https://hibernate.onjira.com/browse/HHH-298

Hopefully there is a better solution. I might create a new request in JIRA if nothing comes up.


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.