Are you are using an XADataSource?
With xa, many transactions can use the same connection, one after the other. When you commit a particular transaction, you identify it by id so the db knows what work to commmit -- the work associated with that id, no matter which connection it came over.
Are there any actual errors or are you just surprised?
1. We are using xa, because we may sometimes need to enlist multiple datasources in the tx.
2. How can a BMT bean commit by id? UserTransaction does not make the id available, and commit() takes no arguments.
3. We are getting application errors because, for example:
a. thread 1 creates an entity (BMT)
b. thread 2 runs a query (CMT) and its tx commits
c. because thread 2 used the same tx as thread 1,
the entity is now visible in the db before other
work on thread 1 is complete.