Ask questions and see you at February, 5th, 6.PM. CET: http://www.ustream.tv/channel/adambien
Also checkout recent episode:
Ask questions and see you at February, 5th, 6.PM. CET: http://www.ustream.tv/channel/adambien
Also checkout recent episode:
What is your approach to this scenario:
There is an Entity with columns: ID and Name. Name is annotated as @column(unique = true)
There is a REST Resource which injects session bean.
POST Request is sent to REST Resource which invokes business method in a session bean.
In a session bean there is a line: em.persist(bean);
The goal is to throw business exception from the session bean when Constraint Violation happens in the database but the exception is not thrown unless you put em.flush(); after em.persist();
Is putting em.flush() a correct approach?
Another approach would be to first find an object with the same Name, but there is still a chance Constraint Violation happens in a race condition.