I am sorry that this is so vague, but perhaps someone here can help. I am using Spring and Hibernate 3 in a web application. I need to perform a query on the database. The Hibernate session is managing a dirty object that corresponds to a row in the table being queried. I do not want Hibernate to update the table before the table is queried, but when I do a getHibernateTemplate.find(), this is what hibernate does.
I have solved the problem by using getHibernateTemplate.evict() on the object, but my impression from _Hibernate_in_Action_ is that this use of evict is discouraged.
So, my questions are: What is a good strategy to pursue? Is it good to use evict() in this way? In general, what kinds of things is it acceptable to use evict() for (other than performance)?
You may not be able to give precise answers to these questions, but if you could give me some leads where I could go to research this question, that would be great, too.
|