-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to enforce read-only transactions?
PostPosted: Tue Jun 26, 2007 1:32 pm 
Newbie

Joined: Tue Jun 26, 2007 12:15 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.