[jboss-user] [EJB 3.0 Users] - Re: how to handle hibernate exceptions in ejb3
grdzeli_kaci
do-not-reply at jboss.com
Tue Nov 10 01:34:45 EST 2009
"Wolfgang Knauf" wrote : Hi,
|
| probably you will have to catch the exceptions which are thrown when calling "entityManager.persist(...)", and in some inner exception you should find the hibernate exceptions and perform the appropriate handling.
|
| Hope this helps
|
| Wolfgang
Thank you very much Wolfgang for your post.
I'll try to explain my case in details.
I have session bean with some operation:
| @Stateless
| @Remote(ContractFasade.class)
| public class ContractFasadeBean implements ContractFasade {
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void createContract(some parameteres .... ) throws MyException{
| try{
| // creating contract into my provisioning system (by WS Client,
| //Creating some file into file system and so on.)
| ..........................................................................
| // then creating contract into my databse(in my case - Oracle)
| oracleManager.persist(someEntity);
| oracleManager.merge(someOtherEntity);
| ...........................................................................
|
| // make some other business logic
|
|
| // also i tried to flush database, thought it can help to catch database exceptions.
|
| oracleManager.flush();
| }
| catch(Exception e){ // catch any exceptions !!!!!!!
| // i need this case !!!!!!!!!!!
| // delete contract from my provisioning system.
| }
| }
| }
|
for some times may occurred hibernate exceptions for example :
ConstraintViolationException
LockAcquisitionException
and so on ...
It's impossible to handle this :(.
Exception occurred when CMT trying to commit database.
Is it possible to handle this ? or maybe I'm on wrong way and there is any other pattern for it ..
I can't find anything in the internet about it.
Thank you very much again.
_____________________
Regards,
Paata Lominadze.
Magticom LTD.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264729#4264729
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264729
More information about the jboss-user
mailing list