java - Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly -


i use spring , problem have code snippet this:

@transactional(rollbackfor = exception.class) private void testmethod1() {     ...      try {         testmethod2();     } catch (customexception e) {         e.printstacktrace();     }     ... } 

and if testmethod2 throws customexception following exception:

could not commit jpa transaction; nested exception javax.persistence.rollbackexception: transaction marked rollbackonly

i tried

@transactional(rollbackfor = exception.class, norollbackfor = customexception.class)     private void testmethod1() {} 

or

@transactional(norollbackfor = customexception.class)         private void testmethod1() {} 

but not work. me out?

thank you!


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -