I have a Java application that use Hibernate OGM framework and Mongo database. When I retrieve a lot of data, the application becomes very slow and one of the bottlenecks is Hibernate.
I read that retrive data in a read-only context improve performance a lot. How can I do that?
I had try with method calls like this:
entityManager.lock(entity, LockModeType.READ);
or:
entityManager.createNativeQuery(query, entity)
.setLockMode(LockModeType.READ)
.getResultList();
but seems there are not supported.
I can not wait 20 minutes for a few megabytes. Please help! Every suggestion is appreciated
In my case I have a tree of one to many associations. The query is on the root, where fetch is set to LAZY. Then i call in a thread the Hibernate.initialize(proxy) method on the second level where the recovery is EAGER, to the deeper level.