Announcement Announcement Module
Collapse
No announcement yet.
CMT + Spring + Hibernate transaction issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CMT + Spring + Hibernate transaction issue

    Hello,

    I ran into a strange problem with spring, hibernate and jboss. Iím using springs HibernateDaoSupport to integrate with jbossís transaction. What I want to do is to catch the exception thrown by HibernateDaoSupport and convert it to a business exception. The problem I throw my exception but the client receives a org.jboss.tm.JbossTransactionRolledbackException instead of mine. This odd behavior is not present when I use jboss-hibernate for integration with the transaction, so this leads me to believe that either I have a configuration problem or there is a problem in Spring. Iíll post below the relevant parts from a test case I used.

    Iím using Hibernate as a service, below is a copy of the jboss-service.xml

    <server>
    <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
    <depends>jboss.jca:service=RARDeployer</depends>
    <attribute name="MapResources">ro/siveco/bdne/model/nomenclatoare/JudetDef.hbm.xml</attribute>
    <attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
    <attribute name="Datasource">java:/BDNEDS</attribute>
    <attribute name="Dialect">net.sf.hibernate.dialect.OracleDial ect</attribute>
    <attribute name="UseOuterJoin">true</attribute>
    <attribute name="ShowSql">true</attribute>
    <attribute name="UserTransactionName">UserTransaction</attribute>
    <attribute name="TransactionStrategy">net.sf.hibernate.transa ction.JTATransactionFactory</attribute>
    <attribute name="TransactionManagerLookupStrategy">net.sf.hib ernate.transaction.JBossTransactionManagerLookup</attribute>
    <attribute name="UseQueryCache">true</attribute>
    </mbean>

    </server>

    Below is the test method from the EJB which is a CMT SLSB (transaction is required on this method)

    public void testMethod(JudetDef judetDef) {
    HibernateDaoSupport dao = new HibernateDaoSupport(){};
    try
    {
    InitialContext ic = new InitialContext( );
    dao.setSessionFactory( ( SessionFactory ) ic.lookup( hibernateFactoryJNDIName ));
    //this will not succeed because the row is referenced by other tables and hibernate will throw an exception.
    dao.getHibernateTemplate().delete(judetDef);
    dao.getHibernateTemplate().flush();
    }
    catch ( Exception e )
    {
    throw new MyBusinessException(e);
    }
    }

    The stack trace I get on the server is

    2004-11-04 12:23:53,346 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] could not delete: [ro.siveco.bdne.model.nomenclatoare.JudetDef#6]
    java.sql.SQLException: ORA-02292: integrity constraint (BDNE.FK_ADRESA_C_REFERENCE_NOM_JUDE) violated - child record found

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:272)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java: 623)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4 CPreparedStatement.java:181)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_fo r_rows(T4CPreparedStatement.java:543)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1028)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:2888)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:2960)
    at com.p6spy.engine.logging.P6LogPreparedStatement.ex ecuteUpdate(P6LogPreparedStatement.java:183)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeUpdate(WrappedPreparedStatement.java :316)
    at net.sf.hibernate.persister.EntityPersister.delete( EntityPersister.java:596)
    at net.sf.hibernate.impl.ScheduledDeletion.execute(Sc heduledDeletion.java:29)
    at net.sf.hibernate.impl.SessionImpl.executeAll(Sessi onImpl.java:2418)
    at net.sf.hibernate.impl.SessionImpl.execute(SessionI mpl.java:2376)
    at net.sf.hibernate.impl.SessionImpl.flush(SessionImp l.java:2240)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$SpringSessionSynchronization.beforeCommit(Sess ionFactoryUtils.java:738)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$JtaSessionSynchronization.beforeCompletion(Ses sionFactoryUtils.java:843)
    at org.jboss.tm.TransactionImpl.doBeforeCompletion(Tr ansactionImpl.java:1383)
    at org.jboss.tm.TransactionImpl.beforePrepare(Transac tionImpl.java:1075)
    at org.jboss.tm.TransactionImpl.commit(TransactionImp l.java:296)
    at org.jboss.ejb.plugins.TxInterceptorCMT.endTransact ion(TxInterceptorCMT.java:457)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:325)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:149)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:128)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(Sess ionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:854)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:242)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:642)
    at org.jboss.invocation.jrmp.server.JRMPInvoker$MBean ServerAction.invoke(JRMPInvoker.java:775)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534)
    2004-11-04 12:23:53,346 ERROR [net.sf.hibernate.impl.SessionImpl] Could not synchronize database state with session
    net.sf.hibernate.JDBCException: could not delete: [ro.siveco.bdne.model.nomenclatoare.JudetDef#6]
    at net.sf.hibernate.persister.EntityPersister.delete( EntityPersister.java:618)
    at net.sf.hibernate.impl.ScheduledDeletion.execute(Sc heduledDeletion.java:29)
    at net.sf.hibernate.impl.SessionImpl.executeAll(Sessi onImpl.java:2418)
    at net.sf.hibernate.impl.SessionImpl.execute(SessionI mpl.java:2376)
    at net.sf.hibernate.impl.SessionImpl.flush(SessionImp l.java:2240)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$SpringSessionSynchronization.beforeCommit(Sess ionFactoryUtils.java:738)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$JtaSessionSynchronization.beforeCompletion(Ses sionFactoryUtils.java:843)
    at org.jboss.tm.TransactionImpl.doBeforeCompletion(Tr ansactionImpl.java:1383)
    at org.jboss.tm.TransactionImpl.beforePrepare(Transac tionImpl.java:1075)
    at org.jboss.tm.TransactionImpl.commit(TransactionImp l.java:296)
    at org.jboss.ejb.plugins.TxInterceptorCMT.endTransact ion(TxInterceptorCMT.java:457)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:325)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:149)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:128)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(Sess ionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:854)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:242)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:642)
    at org.jboss.invocation.jrmp.server.JRMPInvoker$MBean ServerAction.invoke(JRMPInvoker.java:775)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.sql.SQLException: ORA-02292: integrity constraint (BDNE.FK_ADRESA_C_REFERENCE_NOM_JUDE) violated - child record found

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:272)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java: 623)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4 CPreparedStatement.java:181)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_fo r_rows(T4CPreparedStatement.java:543)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1028)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:2888)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:2960)
    at com.p6spy.engine.logging.P6LogPreparedStatement.ex ecuteUpdate(P6LogPreparedStatement.java:183)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeUpdate(WrappedPreparedStatement.java :316)
    at net.sf.hibernate.persister.EntityPersister.delete( EntityPersister.java:596)
    ... 39 more
    2004-11-04 12:23:53,346 INFO [org.springframework.jdbc.support.SQLStateSQLExcept ionTranslator] Translating SQLException with SQLState '23000' and errorCode '2292' and message [ORA-02292: integrity constraint (BDNE.FK_ADRESA_C_REFERENCE_NOM_JUDE) violated - child record found
    ]; SQL was [] for task [SessionSynchronization]
    2004-11-04 12:23:53,346 ERROR [org.springframework.orm.hibernate.SessionFactoryUt ils] beforeCommit callback threw exception
    org.springframework.dao.DataIntegrityViolationExce ption: (SessionSynchronization): data integrity violated by SQL ''; nested exception is java.sql.SQLException: ORA-02292: integrity constraint (BDNE.FK_ADRESA_C_REFERENCE_NOM_JUDE) violated - child record found

    java.sql.SQLException: ORA-02292: integrity constraint (BDNE.FK_ADRESA_C_REFERENCE_NOM_JUDE) violated - child record found

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:272)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java: 623)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4 CPreparedStatement.java:181)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_fo r_rows(T4CPreparedStatement.java:543)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1028)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:2888)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:2960)
    at com.p6spy.engine.logging.P6LogPreparedStatement.ex ecuteUpdate(P6LogPreparedStatement.java:183)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeUpdate(WrappedPreparedStatement.java :316)
    at net.sf.hibernate.persister.EntityPersister.delete( EntityPersister.java:596)
    at net.sf.hibernate.impl.ScheduledDeletion.execute(Sc heduledDeletion.java:29)
    at net.sf.hibernate.impl.SessionImpl.executeAll(Sessi onImpl.java:2418)
    at net.sf.hibernate.impl.SessionImpl.execute(SessionI mpl.java:2376)
    at net.sf.hibernate.impl.SessionImpl.flush(SessionImp l.java:2240)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$SpringSessionSynchronization.beforeCommit(Sess ionFactoryUtils.java:738)
    at org.springframework.orm.hibernate.SessionFactoryUt ils$JtaSessionSynchronization.beforeCompletion(Ses sionFactoryUtils.java:843)
    at org.jboss.tm.TransactionImpl.doBeforeCompletion(Tr ansactionImpl.java:1383)
    at org.jboss.tm.TransactionImpl.beforePrepare(Transac tionImpl.java:1075)
    at org.jboss.tm.TransactionImpl.commit(TransactionImp l.java:296)
    at org.jboss.ejb.plugins.TxInterceptorCMT.endTransact ion(TxInterceptorCMT.java:457)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:325)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:149)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:128)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(Sess ionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:854)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:242)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:642)
    at org.jboss.invocation.jrmp.server.JRMPInvoker$MBean ServerAction.invoke(JRMPInvoker.java:775)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534)
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
    2004-11-04 12:23:53,346 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Removed value [org.springframework.orm.hibernate.SessionHolder@cf 9bf0] for key [net.sf.hibernate.impl.SessionFactoryImpl@1035ff9] from thread [RMI TCP Connection(3)-172.20.1.70]
    2004-11-04 12:23:53,346 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Closing Hibernate session
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 4
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Releasing: 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.EhCache] key: 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.ehcache.store.MemoryStore] ro.siveco.bdne.model.nomenclatoare.JudetDefCache: MemoryStore hit for 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.UpdateTimestampsCache] Invalidating space [NOM_JUDET]
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Releasing: 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.EhCache] key: 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.ehcache.store.MemoryStore] ro.siveco.bdne.model.nomenclatoare.JudetDefCache: MemoryStore hit for 6
    2004-11-04 12:23:53,346 DEBUG [net.sf.hibernate.cache.UpdateTimestampsCache] Invalidating space [NOM_JUDET]
    2004-11-04 12:23:53,346 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled= true
    2004-11-04 12:23:53,362 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.nestedTraceEnabled= false
    2004-11-04 12:23:53,362 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNest ing=true
    2004-11-04 12:23:53,346 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract void ro.siveco.test.Test.testMethod(ro.siveco.bdne.mode l.nomenclatoare.JudetDef) throws java.rmi.RemoteException, causedBy:
    org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=CatalinSa/16, BranchQual=, localId=16] status=STATUS_NO_TRANSACTION
    at org.jboss.tm.TransactionImpl.commit(TransactionImp l.java:344)
    at org.jboss.ejb.plugins.TxInterceptorCMT.endTransact ion(TxInterceptorCMT.java:457)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:325)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:149)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:128)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(Sess ionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:854)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:242)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:642)
    at org.jboss.invocation.jrmp.server.JRMPInvoker$MBean ServerAction.invoke(JRMPInvoker.java:775)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534

    Thank you,
    Catalin Sanda

  • #2
    You're catching the exception generated by the Hibernate code. As far as the transaciton machinery knows (JTA and JBoss inthis case, since you're not using Spring tx), it should still try to commit, since the exception you are throwing is checked (I presume, that's the only way this makes sense). Now if this were with Spring transactions, then you could just add your checked exception as one that should cause a rollback. You don't have that option with EJB and CMT. So you'll have to call setRollbackOnly on your ejb context.

    Hope this is clear.

    Comment

    Working...
    X