Reputation: 971
Somebody knows an example with EJB3 and Mybatis where the container controls the transaction, the only part of code I founded was:
SQLMapConfig.xml
<transactionManager type="EXTERNAL">
<property name="SetAutoCommitAllowed" value="false"/>
<dataSource type="JNDI">
<property name="DataSource" value="java:comp/env/jdbc/sisds"/>
</dataSource>
</transactionManager>
But I have many questions, for example,
Thanks in Advance
Upvotes: 2
Views: 2023
Reputation: 6229
The container commits the transaction based on how your EJBs are configured. If you are using bean managed transactions, then you have to manage the UserTransaction
yourself.
Regardless, you have to manage the MyBatis SqlSession yourself. Setting the tx type to EXTERNAL
(MANAGED
in Mybatis 3), simply means that MyBatis never calls commit on the DB connection - it relies on the container to commit.
Upvotes: 1