I'm using hibernate-entitymanager
with c3p0
. My app does not create any "dynamic" queries using createQuery(...)
nor createNativeQuery(...)
etc: only "named queries" and automatically generated queries from entity classes. Assuming that I want to cache all prepared statements that hibernate may generate, is the formula
4*numberOfEntityClasses + numberOFNamedQueriesInMyCode
for maxStatementsPerConnection
correct? (my guess for 4
comes from 1 for each insert
, update
, delete
and select
).
...or maybe it gets more complicated in case of a complex relation graph between my entities?
Thanks!
update: after a moment of consideration, I'm completely almost sure, that I also need to add 1
for each lazily initialized property. So my current guess is
4*numOfEntities + numOFNamedQueries + numOfLazyProperties
. Anything else that I may be missing? ;-)