Is this Query cache by Session or by SessionFactory ?
To be more accurate : given 2 sessions from the same sessionfactory,
if I call createQuery(myHQL) on one session, this will create a new
QueryImpl. If I recall it on the same session, the query cache should
return me the same QueryImpl instance. Nice.
Now if I call createQuery(myHQL) (the same HQL) on the other session,
does hibernate gives me the previously instanciated query or does it
compile a new one ? Personally I vote for the second choice, while
I would have liked the first one (as both sessions are from the same
sessionfactory). Optionally for thread safety, return a clone of the already
instanciated query.
Am I wrong ?
And thank you for your quick answer Gavin (as usual...).
Sincerely yours
Emmanuel Ligne
|