MyBatis executing multiple sql statements in one go, is that possible?

I’m using myBatis with Oracle. I guess there is something similar in other DB. Actually you always can create procedures in DB, which usually is better for the future, when you have to support the project. <delete id=”deleteUnfinishedData” parameterType=”map”> {call declare begin delete from TABLE1 where id = #{valueFromMap1}; delete from TABLE2 where id = … Read more

How to use Annotations with iBatis (myBatis) for an IN query?

I believe the answer is the same as is given in this question. You can use myBatis Dynamic SQL in your annotations by doing the following: @Select({“<script>”, “SELECT *”, “FROM blog”, “WHERE id IN”, “<foreach item=’item’ index=’index’ collection=’list'”, “open='(‘ separator=”,” close=”)”>”, “#{item}”, “</foreach>”, “</script>”}) List<Blog> selectBlogs(@Param(“list”) int[] ids); The <script> element enables dynamic SQL parsing … Read more

How to configure Spring to make JPA (Hibernate) and JDBC (JdbcTemplate or MyBatis) share the same transaction

I’ve found the solution here: What transaction manager should I use for JBDC template When using JPA ? I’m using JpaTransactionManager and not DataSourceTransactionManager. JavaDoc http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/orm/jpa/JpaTransactionManager.html This transaction manager also supports direct DataSource access within a transaction (i.e. plain JDBC code working with the same DataSource). This allows for mixing services which access JPA and … Read more