How to catch SQLException from CMP entity bean?
843830Feb 7 2005 — edited May 16 2006I 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.