Is there a simple way with hibernate log level to see when the first cache level is used or not ?
If I'm doing the following hql request : "from Document d left join fetch d.folder where d.id=2"; several time, in the same session, will the cache be used ?
Thanks
Hibernate L1 cache stores entities by primary key. This means that if you load the same entity using load()
or get()
(I think this also applies to simple queries like: from Document d where d.id=2
) it will be cached.
In your case the query is a bit more complicated and you will have to use L2. Unfortunately there is no logger indicating L1 activity (at least not documented) but seeing SQL queries shouls be enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With