4 Replies Latest reply on Aug 5, 2010 5:44 PM by Rafael Viana

    Envers is hiding exceptions

    Rafael Viana Newbie

      Hi,

       

      I experienced a strange problem that Hibernate isn't saving/updating/deleting sometimes.Then, I discovered that was occuring an error saving the Enver's revision entity.However, this exception wasn't throwed.

       

      Steps to reproduce the problem (throw any exception):

       

      For example:

       

      Create a not-null column in any table:

      When you'll try to save, the exception is throwed:

      Caused by: java.sql.SQLException: Field 'code' doesn't have a default value

       

      Drop this column and create a not-null column in the audited table:

      When you'll try to save, none exception is throwed, but when you find the register in database.

      It wasn't there and none exception was throwed...

       

      But, when using a profiler I can see:

      INSERT INTO table ...

      INSERT INTO rev_info ..

      INSERT INTO table_AUD...

      ERROR: Field 'code' doesn't have a default value

      ERROR: Could not synchronize database state with session

      rollback transaction //with the rollback the register wasn't saved

      Eexception calling user Synchronization: Could not execute JDBC batch updateorg.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update

      commit transaction //in the end the transaction is commited and says to my customer: yes your register was saved.... but it wasn't

       

      Is there any to throw an exception with any error in Envers?