Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to catch SQLException from CMP entity bean?

843830Feb 7 2005 — edited May 16 2006
I have one table where one column "code" has to be unique (database consistency constraint). The table is mapped into CMP entity bean. When I try to create another bean (record) with a code already used in other record DB complaints and runs transaction rollback and through jdbc sends SQLException (duplicate key). I see this SQLException and its message in JBoss console but I don't know how to catch this SQLException inside CMP EJB since entity bean create() method throws only CreateException(), no SQL Exception. Is there any code sample showing how one can catch SQLException in CMP bean and destingwish duplicate key error from other creating exceptions.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2006
Added on Feb 7 2005
7 comments
239 views