Bugs item #472868, was opened at 2001-10-19 11:12
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=472868&group_id=22866
Category: JBossTX
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Session synch + UserTransaction broken
Initial Comment:
If the SessionSynchronization interface is implemented
in a stateful session bean, the database can normally
be updated in the beforeCompletion callback. (This
works.) However, if UserTransaction is used to control
the transaction from the client, the database is not
updated (although no exception is thrown.)
Speculation: could this be because the resources are
not enlisted in the transaction when commit() is
called from UserTransaction?
In the client, the following code works:
UserTransSessionTest test =
getUserTransSessionTestHome().create();
UserTransaction ut = getUserTransaction();
//ut.begin();
test.doNothing();
//ut.commit();
whereas this code fails to update the database:
UserTransSessionTest test =
getUserTransSessionTestHome().create();
UserTransaction ut = getUserTransaction();
ut.begin();
test.doNothing();
ut.commit();
The session synchronization interface is implemented:
public class UserTransSessionTestBean implements
SessionBean, SessionSynchronization
The "beforeCompletion" method is quite simple:
public void beforeCompletion() throws
javax.ejb.EJBException, java.rmi.RemoteException
{
System.out.println( "Before completion" );
Connection con = null;
try
{
InitialContext initial = new InitialContext();
DataSource ds = (DataSource) initial.lookup
( "java:DefaultDS" );
con = ds.getConnection();
Statement s = con.createStatement();
s.executeUpdate("insert into TestUserTrans
(valkey) values (15) ");
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (con != null)
con.close();
}
catch (Exception e2)
{
}
}
}
The "doNothing" method that the client calls is a no-
op:
public void doNothing()
{
}
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=472868&group_id=22866
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development