Org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role (Hibernate + Spring)?

When a query returning entity instance(s) is cacheable and you have a cache hit, the cache returns only the ID(s) of the entity(ies), and then the session is used to load the entity(ies). This means that the join fecth is not applied anymore when you have a cache hit. This also means that all the entity instances returned by the query should also be in the second-level cache, else the performance might in fact be worse than without the query cache.

When a query returning entity instance(s) is cacheable and you have a cache hit, the cache returns only the ID(s) of the entity(ies), and then the session is used to load the entity(ies). This means that the join fecth is not applied anymore when you have a cache hit. This also means that all the entity instances returned by the query should also be in the second-level cache, else the performance might in fact be worse than without the query cache.

You should thus use initialize(document. GetUploadedDocumentsById() in the DAO to make sure it's initialized.

Oh, this works perfectly. But every time I refresh the page, a query for the fetched entity is made... Will be good to reduce it. – Vassilen Dontchev Aug 9 at 18:13.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions