[jboss-user] [EJB 3.0] - Re: Transaction annotation - cannot get desired behavior
amitka
do-not-reply at jboss.com
Mon May 21 02:58:30 EDT 2007
This will only work for EntityExistsException due to primary key constraint. The situation I encountered is with a unique constraint on other columns which are not primary keys.
I used the setter methods to set some field values, and then handled both InvalidStateException to retrieve all of the InvalidValue-s, and EntityExistsException to know if a unique constraint has been violated. The problem is that in the catch block of the EntityExistsException, I couldn't query and extract which field's uniqueness the update tried to violate. The only solution I did find was to receive another instance of the (same) bean (from itself), and invoke a REQUIRES_NEW method on that other instance which does the query.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047115#4047115
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047115
More information about the jboss-user
mailing list