I have four methods two of them are in one stateless session bean and other two are in another stateless session bean. A method in another stateless session bean calls all these four methods and executing them as a single transaction. The transactional attribute for all the four methods mentioned are "Required". In each method, I take the connection from the connection pool and close them in the finally block. There is no connection.commit().
But, as far as I know, the transactions should use a single connection. But here, all the methods take the connection from the pool and use them and finally close them. I am getting how the transaction is happening in such situation. How does the application server take care of this situation? Are all the connections held up until the transaction is over?
Could you please clarify me, whether the approach for transaction I mentioned here is correct or not? If yes, please clarify my doubts.