1 Reply Latest reply on Jan 10, 2012 4:27 AM by Emir Calabuch

    Seam Transaction Management problem

    Jubril Adisa Novice

      I really don't understand why JPA was bundled with Seam but its not providing that basic flexibility whit regards to Transaction Management.

      when i run this code, i don't expect to see data in my database but i do. I am using MySQl

                              User user=new User();
                              int i=9/0;
                      }catch(Exception e){

        • 1. Re: Seam Transaction Management problem
          Emir Calabuch Newbie

          You're catching and handling the exception in the same code block, so it is as it never happened. Seam (or any other framework) gets to know there was an exception only when you don't catch it. If the exception was raised in the call to persist(), Hibernate would have marked the exception for rollback, but the ArithmeticException you're rising does not.

          Try generating the exception and not catching it.

          Also, be advised that transactions are not necessarily rolled back after an exception occurs. This happens only if the exception extends RuntimeException (which ArithmeticException does) or the exception is marked with @ApplicationException.