Marina,
Thank you for clarifying the capabilities and restrictions in this situation.
As you say, if you do an em.flush() the PersistenceException will be thrown of a constraint fails. Will this force a txn rollback or can you do your constraint query from inside the catch in the sesion bean? This would both allow you to only do your extra constraint query if the database rejects the original update, and do it on the server, which I think would be preferable. Then you could return an application specific exception detailing why the txn failed, e.g. unique constraint violation on field "x". Or must you catch this PersistenceException in the client and initiate recovery from there?
Thanks again.
Rick
[Message sent by forum member 'rickhoro' (rickhoro)]
http://forums.java.net/jive/thread.jspa?messageID=234297