I have created a little sandbox project to exhibit the behavior I am seeing:
https://github.com/jwcarman/camel-transaction Right now, I only have two test cases in there and the only difference between the two is that I'm using this code for the passing one: https://github.com/jwcarman/camel-transaction/blob/master/src/main/java/com/carmanconsulting/camel/jpa/MyEntityRepositoryPersistWithFlush.java and I'm using this code for the failing one: https://github.com/jwcarman/camel-transaction/blob/master/src/main/java/com/carmanconsulting/camel/jpa/MyEntityRepositoryPersistNoFlush.java The difference is whether or not I use the flush() call or not on my EntityManager. If I do, everything works fine, since the exceptions I'm causing (null value constraint and length constraint violations) are thrown immediately during route processing. If I do not, then the exception isn't thrown until commit() is called on the PlatformTransactionManager. Is this expected behavior?
