-
1. Re: Transaction rollback bug with entity bean business metho
dciarnie Oct 4, 2001 1:32 PM (in response to msquance)The following thread may provide the answer you're looking for:
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ -
2. Re: Transaction rollback bug with entity bean business metho
msquance Oct 4, 2001 3:01 PM (in response to msquance)Thanks for the suggestion, but I think I'm dealing with a different problem. It may be related, but at this point, I'm not ready to look at the JBoss source.
I've reduced it down to a very simple case that doesn't even involve any actual transactions, connections, db access, etc.
Here's what I've got:
Home Interface:
public interface DummyHome extends EJBHome
{
public Dummy create( int id ) throws RemoteException, CreateException;
public Dummy findByPrimaryKey( Integer key ) throws RemoteException, FinderException;
}
Remote Interface:
public interface Dummy extends EJBObject
{
public void someMethod() throws RemoteException;
}
EJB Implementation:
public class DummyEEJB implements EntityBean
{
public Integer ejbCreate( int id ) throws CreateException
{ id_ = id; return new Integer( id_ ); }
public void ejbPostCreate( int id ) { }
public Integer ejbFindByPrimaryKey( Integer id ) throws FinderException
{ return id; }
public void ejbRemove() { }
public void ejbLoad() { }
public void ejbStore() { }
public void ejbActivate()
{
Integer id = (Integer) entityContext_.getPrimaryKey();
id_ = id.intValue();
}
public void ejbPassivate() { }
public void setEntityContext( EntityContext context )
{ entityContext_ = context; }
public void unsetEntityContext() { }
public void someMethod()
{ entityContext_.setRollbackOnly(); }
private int id_ = 0;
private EntityContext entityContext_ = null;
}
ejb_jar.xml:
<ejb-jar>
Test
<display-name>Test</display-name>
<enterprise-beans>
<ejb-name>Dummy</ejb-name>
com.asi.test.DummyHome
com.asi.test.Dummy
<ejb-class>com.asi.test.DummyEEJB</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
False
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<ejb-name>Dummy</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
jboss.xml:
<enterprise-beans>
<ejb-name>Dummy</ejb-name>
<jndi-name>test/Dummy</jndi-name>
</enterprise-beans>
If I have a client (non-EJB) that creates an instance, then calls someMethod() twice, the second call will hang with the LOCKING-WAITING message as above.
I can work around this simple case by throwing an EJBException instead of calling setRollbackOnly and then its okay. However, my real scenario has another bean call involved which is failing (thus marking for rollback). In this case, if the context is marked for rollback, it doesn't seem to matter if I throw an EJBException. The result is the same.
Any ideas or workaround suggestions would be appreciated.
Thanks,
Mike.