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
Post a Comment