Hi Chrstian,
Thanks for replying.
The usecase I have in mind is slightly different and can't use projection queries. I load an object graph into memory, perform some operations/modifications on them, and eventaully I
commit the transaction. When I commit the transaction, as far as I understand, Hibernate checks if any instance in the object graph is dirty and updates the data in the DB.
While doing this, if I am
certain that instances of a particular entity class wont change. I am looking for some API where I can hint Hibernate not to bother checking dirtiness of some portion of the object graph. I expect this to be slightly more performant than the regular way.
I cannot use projection queries here because I dont want the whole object graph to be non-transactional.
I was expecting something like :
Code:
Session session = mySessionFactory.openSession().setReadOnly(MyReadOnlyClass.class);
Kindly advise how to handle such cases.
Thanks again for your time.