Originally posted by vu lee:
What is the transaction attribute on ejbPostCreate()? Make sure it is running under the same transaction as it is in ejbCreate().
apigee, a better way to API!
apigee, a better way to API!
Correct me if i am wrong. But the container always calls the ejbCreate() and ejbPostCreate() methods in the same transaction context. As far as i remember, that is what the specs(2.1) mention.
In this case, the author used utility class which in turn used JDBC to insert related data. Even ejbCreate() and ejbPostCreate() were running under the same transaction, if the utility class used different transaction to insert data, it would run in different transaction.
apigee, a better way to API!
I thought it was getting the connection from the weblogic datasource, this would mandate that the statements executed on the connection will be in the same tx context as ejbPostCreate.
Originally posted by Mark Savory:
Yes I suspected that the utility and the ejb were using a different Connection objects(session). How would I ensure that they're using the same Connection object? Can I somehow get the Connection object from the CMP and pass it to the utility?
apigee, a better way to API!
Getting connection from the datasource does not guarantee ejbcreate() and ejbpostcreate() are running under the same transaction. To demonstrate my point, for example, suppose the utility client is a BMP, which gets connection from the same connection pool, then these two methods would run under different transactions since BMP would run under different transanction. (My understanding is that BMP does not accept inbound transaction.)
Assume these methods are working correctly. If these two methods were running under the same transaction, ejbpostcreate() would have seen whatever intentionally written to the database by ejbCreate(). Since ejbpostcreate() did not see whatever written to database by ejbCreate() in the transaction context, these two methods could have ran under different transactions.
apigee, a better way to API!
Originally posted by Mark Savory:
I tried setting <delay-updates-until-end-of-tx> to false already but it didn't make a noticable change in behavior.
apigee, a better way to API!
Originally posted by Mark Savory:
I'm happy to try different things but I'm wondering about this one. The transaction level TRANSACTION_READ_UNCOMMITTED is supposed to allow other transactions to read uncommited data that was modified from another tranaction. One, why would you ever want to do that? Two, what does this have to do with my stated problem?
apigee, a better way to API!
Don't get me started about those stupid light bulbs. |