As part of the work on JDBC pools, I check whether there's
currently a transaction. I'm not finding any, which is a little
confusing. In my ejb-jar.xml I have:
<transaction-type>Container</transaction-type>
Which I though meant container-managed persistence and that every
EJB call would be part of a transaction. But when the bean gets a pool
reference (without using a resource reference - see previous message on
jBoss user) and the pool checks for a transaction, there isn't one:
TransactionManager tm = (TransactionManager)ctx.lookup(tmJndiName);
if(tm.getStatus() != Status.STATUS_NO_TRANSACTION) {
// never happens
...
}
Are entity beans the only ones that get Transactions? I didn't
think this was true - because a session bean can make updates via a
datasource, right?
Could this be because I bind an instance of TransactionManager to
a JNDI name once at the beginning, so it has the wrong ThreadLocal, and
thus the wrong information? Would the TransactionManager need to be bound
for every method invocation to get the right ThreadLocal? Then we'd need
a private JNDI namespace somehow, I guess. This doesn't sound right.
Aaron