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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -