> Hello,
>
> Is it true that Entities that use named query that
> are complex aren't cached ?
Best of my knowledge, that's not true (specifically in regards to Toplink Express).
What happens is that the JPA will make an actual SQL call to the server -- this will always happen.
Upon return, if any of the entities that are in the result also happen to be cached, the JPA will use the cached entities rather than the data from the query.
Mind, this is dependent on the nature of the query of course (notably assuming that it's returning entire entities, and not just a collection of scalars).
So, in the sense that the JPA will always make a call to the backing database, then, it's true that the queries aren't "cached". But in terms of the actual data returned by the query to the call, it may well be cached.
Finally, the Toplink makes it a point to bind variables to queries, so most likely the actual SQL statement will be cached on the backend database, but that's database specific and out of scope for the JPA. Rather, Toplink is aware the many databases do this and tries to be friendly to such databases. This statement cache helps reduced parsing and processing time on the back end.
[Message sent by forum member 'whartung' (whartung)]
http://forums.java.net/jive/thread.jspa?messageID=299473