This is a "where do I start" question.
I'm interested in catching certain kinds of bug (notably that changes are made to persistent objects during transactions that are not supposed to have side-effects) in existing code that I am porting to Hibernate. It's not obvious to me which approach to take:
- Query.setReadOnly()
- Use an L2 cache with read-only set
- Write an interceptor
This requirement applies only to certain transactions (roughly, those created for HTTP GET operations) which operate on a group of classes/objects, other transactions which operate on the same classes/objects _do_ need to be able to make persistent changes.
It is not sufficient merely to prevent bug-originated changes from making their way into the database (e.g. by aborting all transactions that aren't supposed to have side-effects); if bugs of this type exist, I want to know about it pretty early, ideally by having an exception thrown whenever a setter is called, but at least by transaction's end.
My immediate objective isn't performance (most references to read-only anything appear to be about this), but early notification of a certain class of bug.
Suggestions?
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using: HSQLDB/PostgreSQL
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html