|
Re: Change Collection Mapping Selection Criteria on the fly [message #1776798 is a reply to message #1776423] |
Tue, 21 November 2017 17:59 |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Using "a.b.id =10" does not cause any Bs to be fetched - this is entirely controlled through the mapping and 'fetch' qualifiers or hints added to the query. Unfortunately, what you are looking for seems to be a way to manipulate how entities are built based on the criteria selection, rather than just what is returned. Your query will return associated As, but has no way of controlling the references from A, and is beyond JPA - JPA requires entities to match what is in the database, as providers need a way to be able to handle changes.
What you might try instead is returning the Bs or other associated entities and work backward to the A. in the example, you could either select for B, or return A and Bs, and use these results rather than traverse the A->B reference:
"Select a, b from A a join a.b b where b.id = 10"
EclipseLink does allow filtering on the mapping, but this isn't dynamic - it is meant for implementing things like soft deletes.
|
|
|
|
Powered by
FUDForum. Page generated in 0.01840 seconds