|Re: JPQL join and collection association [message #734108 is a reply to message #734078]
||Thu, 06 October 2011 17:37
| Chris Delahunt
Registered: July 2009
I believe what is being said is that the query is correctly returning docs that reference a docs.adviceStatus2 = 100. What is being stated is that the returned and so managed PrintItemInfo's 1:M collection of PrintDocumentsInfo is fully populated and not filtered based on the query. |
If so, this is as expected. The query is to give back fully populated PrintDocumentsInfo. All references will contain all the information associated to the entities as they exist in the database. So the PrintItemInfo's referenced from these returned PrintDocumentsInfo must be full populated and not use the criteria from the query, as doing so would corrupt the cache - these entities are managed so other queries in the same EntityManager context are expected to return the same instance.
My suggestion would be not access the PrintItemInfo's collection so that it remains untriggered, and just used the collection of PrintDocumentsInfo entities returned from the query directly, sorting them by their PrintItemInfo.
[Updated on: Thu, 06 October 2011 17:38]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02601 seconds