I'm using a container manager bean who relies on a table defined as follows:

create table my_table ( id char(10) UNIQUE PRIMARY KEY, ....);

As one can see, the first column stands for the primary which is mapped onto
a corresponding entity bean. Its home is defined as follows:

interface MyBeanHome extends EJBHome {
    MyBean create(String id) throws CreateException, DuplicateKeyException,
RemoteException;

    ....
}

As one can see, I have included the exception list the DuplicateKeyException
because I want to be notified that there exists a bean (that is a row in the
table) with the same primary key. My dream was to be notified by a
DuplicateKeyException that such a primary key is in use. The only thing I
receive is an EJBException, which is rather ok, since the there was a
java.sql.SQLException thrown after the container tried to make the container
persist. I think this is a correct behaviour since the container can by no
mean distinguish beetween a failure and that the integrity is being
violated.

My question is two fold:

1- First of all, how can I get a DuplicateKeyException instead of an
EJBException?

2- How can I get rid of the stack trace of the java.sql.SQLException that
JONAS prints? I tried to change the setting of the jonas.properties file so
that the jonas.trace.level  parameter is set to none. No effect at all! I
still have this dirty stack trace.



Olivier Richaud
CSTB
office: +33 4 93 95 67 24
mobile: +33 6 87 52 53 17
www: http://cic.cstb.fr


----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to