Is there a way to filter children of a mapped relationship? For example, I have a simple 3-tiered object structure,
Person --(OneToOne)--> AddressChain --(OneToMany using a simple 2 column join table)--> Address In the interest of keeping historical data, I use a status column on records in the Address table, "Active" and "Deleted" When I query to get a "Person" object, I only want it to contain Address objects that are "Active." Unfortunately, doing a simple query like the one below doesn't work, because what happens is that it fetches the person, and then separately under the covers goes and finds ALL associated address chains and addresses via the mapping relationship, including the ones marked Deleted. I don't see any annotations to instruct the mapping to filter by status (at least, in OpenJPA. It seems like hibernate may have a filtering capability). Any ideas? Thanks in advance. SELECT p from Person p, Address a WHERE p.id=? and a.status="Active" I have also tried variations such as the following to no avail. SELECT p, c, a from Person p, AddressChain c, Address a WHERE p.id=? and a.status="Active" -- View this message in context: http://n2.nabble.com/Filtering-Results-of-a-Mapped-Relationship-tp4210420p4210420.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
