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

Emmanuel Bernard emmanuel at hibernate.org
Thu Apr 3 10:28:55 EDT 2008


Such validations are typically trigger before flush (ie before  
Hibernate) by either your application or your application framework.  
For example Seam triggers the validation in each marked "form".
The right place to ask such questions is forum.hibernate.org though.

On  Apr 3, 2008, at 08:27, Vallon, Justin wrote:

> 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/#transactions-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
>
>
>
> ***********************************************************************
> 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.
> ***********************************************************************
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

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


More information about the hibernate-dev mailing list