Thta won't work. This problem has been around since the birthdays of Hibernate.
Basically it comes down to this: The exception that is throw isn't thrown back through the call-chain, but rather through the container. This exception doesn't 'land' back in your application until it reaches the starting point of the transaction, which must commonly is your Session Facade. To this day, I haven't found a fix for this problem, but I will keep trying. ps. Even if calling flush() were to fix the problem, it still wouldn't be the solution, since you are flushing your entire EntityManager, which can cause a problem that wasn't created in the current unique-contraint situation, but it would be caught there, giving you the false impression that a unique contraint was violated. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950797#3950797 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950797 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user