I've been checking the Hibernate docs for the EntityManager and it suggests that the EntityManager should throw exceptions for errors that occur while interacting with the persistence layer see :-
So can anybody comment on why the EntityManager does not throw an exception when I attempt to add two entities with duplicate data in a Field marked as Unique. As I stated earlier the EventListener and AbstractBatchers catch the exception and the JDBCExceptionReporter logs the exception, but that is no use to me when I need to deal with the exception in my StatelessSessionBean.
Any comments ?
AFAIU the entitymanager will throw these exceptions. However, it is not stated when these exceptions need to be thrown, and they will (in the case of hibernate) only be throws on session.flush and/or tx commit.
Yes it makes sense for the EntityManager to throw the exception after a flush executes. However it appears that in this situation an exception is not being thrown by the EntityManager.
Question : Is this a bug ? If it is, how do I flag it to the powers that be ?