0 Replies Latest reply on Oct 17, 2011 8:03 AM by Uli Steinkopf

    Hibernate ValidationException Handling

    Uli Steinkopf Newbie

      According to Hibernate manual a hibernate session is invalid if any exception (including validation excpetion) occured:

      13.2.3. Exception handling

      If the Session throws an exception, including any SQLException, immediately rollback the database transaction, call Session.close() and discard the Session instance. Certain methods of Session will not leave the session in a consistent state.

      How belong this behaviour to the fact that seam spans the hibernate session to the conversation? Is the conversation lost? How handles seam invalide hibernate sessions in conversation?

      For me is relevant, coz in our application a modal dialog in a conversation validates its values on persist by hibernate validator. If that fails following changes of model values in the dialog causes further exceptions. The user has no chance to correct values...

      Is this a kind of design problem in our app? Should validation called explicitly before hibernate persist methods...maybe in service layer..??