Ram, thats exactly where my question is. You said
connection is used in a transaction and probably return the same connection object for your next call for getConnection() in dao2
Is it probably the same connection or always the same connection.
(1)If its probably same connection, which means the second dao is getting a different connection (under the same transaction), and hence the EJB's transaction manager is handiling the transaction that involves two different connections. Is this right?
And then In such case why would container have to do any thing special with the first connection (like keeping aside or lokced state), because by keeping the previously closed connection its wasting first connection. If the reason for keeping it aside/locked is to gather the associate the transaction data from the connection, then why would dao2 waste another connection instead of using the first connection.
(2) always the same connection doesn't seem right anyways.