posted 18 years ago
Hi,
I hope this is an advanced question. I have exhausted two text books and most forums and cannot get an answer.
I have a CMP Entity Bean that persists to a table that has one column with a UNIQUE index.
When my client sends a JMS message to a Message Driven Bean to create another Entity Bean using data that contains a duplicate value for the UNIQUE column, I can see the SQLException on my server log.
BUT .. it seems impossible to get the container to thrown it back up to either my Entity Bean create()code or to the Message Driven Bean onMessage () method code.
Actually what happens is the server tries 11 times to create the record with the duplicate entry. It throws 11 SQLExceptions on the server log. It adds 11 junk records to the data base (all null entries except the PK which is auto generated), and my message driven bean sails happily along unaware of the error.
I know the last, because after my my onMessage () method creates an Entity Bean, it sends a message to the client saying whether it encountered an error. And it sends 11 messages saying ... nope just fine.
I know I can catch it if I switch to BMP, but it seems incomprehensible that CMP would not have some mechanisim to send something as simple as duplicate column entry back to the entity bean code or to the message driven bean code that tried to create the entity bean.
Am I missing something?
I hope this is a beginners error that only an advanced programer knows the answer to.
GLB