These are BMP beans. As for letting the container handle the exceptions, I'm catching the exception in the session bean and, in all circumstances, throwing a new EJBException.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Michael Jara Sent: Tuesday, January 15, 2002 5:06 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] Help needed with transactions I don't think you should need to setRollbackOnly in this case. I beleive database errors in CMP trigger an EJBException or a RemoteException(, I forget which one.) Both should auto-rollback the transaction. I've done very little EJB work since JBoss 2.2.2, but transactions definitely worked back then. :) Are these CMP beans? Are you letting the container handle the exceptions? Mike ----- Original Message ----- From: "David Jencks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 15, 2002 2:41 PM Subject: Re: [JBoss-user] Help needed with transactions > Do you catch the exception in your session bean and call setRollbackOnly? > > david jencks > > On 2002.01.15 15:58:02 -0500 Eric Kaplan wrote: > > I have two entity beans that need to be updated within a transaction. In > > my > > case, I have a session bean which updates bean A, then tries to create a > > new > > bean B. If the creation of bean B fails (in this case, I violate a > > unique > > index restriction on the db), then I would expect that the modification > > of A > > would be rolled back. In my ejb-jar.xml, I have transaction attribute > > "Required" for all session and entity methods. The jboss log prints out: > > > > [Default] prepare insert > > [PortfolioEJB] TRANSACTION ROLLBACK EXCEPTION:null > > Embedded Exception > > ORA-00001: unique constraint (ABPDEV.NAME_INDEX) violated > > ; nested exception is: > > javax.ejb.EJBException: null > > Embedded Exception > > ORA-00001: unique constraint (ABPDEV.NAME_INDEX) violated > > > > [PortfolioEJB] java.sql.SQLException: ORA-00001: unique constraint > > (ABPDEV.NAME_ > > INDEX) violated > > [PortfolioEJB] > > [PortfolioEJB] at > > oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:1 > > 68) > > [PortfolioEJB] at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208) > > [PortfolioEJB] at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543) > > [PortfolioEJB] at > > oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405) > > > > [PortfolioEJB] at > > oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol. > > java:822) > > [PortfolioEJB] at > > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStat > > ement.java:1446) > > [PortfolioEJB] at > > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleState > > ment.java:1371) > > [PortfolioEJB] at > > oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Oracl > > eStatement.java:1900) > > [PortfolioEJB] at > > oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Orac > > lePreparedStatement.java:363) > > [PortfolioEJB] at > > com.armanta.ejb.SimpleJDBCAbstraction.insert(SimpleJDBCAbstra > > ction.java:39) > > [PortfolioEJB] at > > com.armanta.ejb.ValueContainerBean.create(ValueContainerBean. > > java:101) > > [PortfolioEJB] at > > com.armanta.ejb.portfolio.PortfolioBean.ejbCreate(PortfolioBe > > an.java:26) > > [PortfolioEJB] at java.lang.reflect.Method.invoke(Native Method) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPP > > ersistenceManager.java:136) > > [PortfolioEJB] at > > org.jboss.ejb.EntityContainer.createHome(EntityContainer.java > > :616) > > [PortfolioEJB] at java.lang.reflect.Method.invoke(Native Method) > > [PortfolioEJB] at > > org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome > > (EntityContainer.java:843) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke > > Home(EntitySynchronizationInterceptor.java:231) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(En > > tityInstanceInterceptor.java:154) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(Entity > > LockInterceptor.java:108) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept > > orCMT.java:135) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx > > InterceptorCMT.java:307) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxIntercept > > orCMT.java:86) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(Security > > Interceptor.java:103) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogIntercepto > > r.java:106) > > [PortfolioEJB] at > > org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java > > :420) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke > > Home(JRMPContainerInvoker.java:437) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(Ho > > meProxy.java:237) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomePr > > oxy.java:182) > > [PortfolioEJB] at $Proxy59.create(Unknown Source) > > [PortfolioEJB] at > > com.armanta.ejb.portfolio.PortfolioMasterBean.createNewPortfo > > lio(PortfolioMasterBean.java:28) > > [PortfolioEJB] at java.lang.reflect.Method.invoke(Native Method) > > [PortfolioEJB] at > > org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor. > > invoke(StatelessSessionContainer.java:543) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBM > > T.java:276) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.inv > > oke(StatelessSessionInstanceInterceptor.java:87) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInte > > rceptor.java:128) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.ja > > va:195) > > [PortfolioEJB] at > > org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessi > > onContainer.java:286) > > [PortfolioEJB] at > > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke > > (JRMPContainerInvoker.java:393) > > [PortfolioEJB] at java.lang.reflect.Method.invoke(Native Method) > > [PortfolioEJB] at sun.rmi.server.UnicastServerRef.dispatch(Unknown > > Source) > > [PortfolioEJB] at sun.rmi.transport.Transport$1.run(Unknown Source) > > [PortfolioEJB] at java.security.AccessController.doPrivileged(Native > > Method) > > [PortfolioEJB] at sun.rmi.transport.Transport.serviceCall(Unknown > > Source) > > [PortfolioEJB] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown > > Sou > > rce) > > [PortfolioEJB] at > > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unkn > > own Source) > > [PortfolioEJB] at java.lang.Thread.run(Unknown Source) > > > > In jboss.jcml, I set > > > > <mbean code="org.jboss.tm.TransactionManagerService" > > name="DefaultDomain:service=TransactionManager"> > > <attribute name="TransactionTimeout">300</attribute> > > > > <attribute name="XidClassName">oracle.jdbc.xa.OracleXid</attribute> > > </mbean> > > > > <mbean code="org.jboss.jdbc.JdbcProvider" > > name="DefaultDomain:service=JdbcProvider"> > > <attribute name="Drivers">oracle.jdbc.driver.OracleDriver</attribute> > > <!--attribute > > name="Drivers">oracle.jdbc.xa.client.OracleXADataSource</attribute--> > > </mbean> > > > > <mbean code="org.jboss.jdbc.XADataSourceLoader" > > name="DefaultDomain:service=XADataSource,name=ArmantaDevLocalJDBCPool"> > > <attribute name="PoolName">ArmantaDevLocalJDBCPool</attribute> > > <!--attribute > > name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attr > > ibute--> > > <attribute > > name="DataSourceClass">oracle.jdbc.xa.client.OracleXADataSource</attribute> > > <attribute > > name="URL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=localhost)(PROTOCOL > > =tcp)(PORT=1521))(CONNECT_DATA=(SID=dev)))</attribute> > > <attribute name="JDBCUser">abpdev</attribute> > > <attribute name="Password">abpdev</attribute> > > <attribute name="MinSize">2</attribute> > > <attribute name="MaxSize">10</attribute> > > <attribute name="IdleTimeoutEnabled">true</attribute> > > </mbean> > > > > In jboss.properties, I set: > > > > jboss.xa.xidclass=oracle.jdbc.xa.OracleXid > > > > Any ideas? It sure would be nice if transactions worked. > > > > Thanks > > > > -------------------------------------------------------------------------- -- > > ---------- > > Eric Kaplan > > Armanta, Inc. > > 55 Madison Ave. > > Morristown, NJ 07960 > > Phone: (973) 326-9600 > > > > > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
