[hibernate-dev] Extended sessions and (lack of) recovery from Hibernate exceptions (ie: validation)

Vallon, Justin jvallon at bear.com
Thu Apr 3 08:27:18 EDT 2008


Suppose a field has a validator, and the field is made invalid (age <
0).  When flushing, the validator runs, and throws an exception.  The
exception handling section
(<http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#transac
tions-demarcation-exceptions>) states that if any method throws an
exception, the session must be closed.

 

So, what to do if session-per-conversation is used?  If hibernate
validation is used, then flush of invalid data corrupts the session -
the application then needs to ask the user to start over, or else build
complex recovery logic (new session, copy data to new session) -
effectively reducing session-per-conversation to
session-per-transaction, since the application needs to be able to
replay transactions that fail due to validation.

 

How does hibernate validation interact with extended sessions?

 

-Justin

office 8-383-6725, 212-272-6725; cell 917-861-6042

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080403/e1c28062/attachment.html 
-------------- next part --------------


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************



More information about the hibernate-dev mailing list