Tuesday, April 19, 2016

MyBatis 3.4.0 & MyBatis-Spring 1.3.0 & Boot-Starter 1.1.1 releases!

Dear Community,

We are pleased to announce three new releases.

MyBatis 3.4.0 with the following main features:
  • New Cursor List method in SqlSession.
  • Inherit Spring timeout in transactions.
  • Better support for generic types.
  • Out-of-the-box support new Date and Time API (JSR-310) classes added in Java 8.

Note that there are changes that may break existing code.
  • New method getTimeout() in the Transaction interface. If you implemented your own transaction adapter you will need to implement this method at least with a "return null"
  • @Options( flushCache ) now takes enum values (DEFAULT/TRUE/FALSE) instead of boolean.
  • StatementHandler#prepare(Connection) has been changed to StatementHandler#prepare(Connection,Integer) given that now it gets the transaction timeout.

See the details at the project's tracker

MyBatis-Spring 1.3.0 with:
  • Support for Cursor List (also for Spring Batch)
  • Requires MyBatis 3.4.0

See the details at the project's tracker

And MyBatis-Spring-Boot-Starter 1.1.1 that includes:
  • Autoscan will only pick interfaces annotated with @Mapper. Note that this change is backward incompatible. In case you are not using the @MapperScan annotation you should mark your mappers with the new @Mapper annotation shipped with MyBatis 3.4.0.
  • Requires MyBatis-Spring 1.3.0
  • And yes... your suspicions are correct, there is no 1.1.0 version. In fact, it is in maven central but the artifact is wrong :)

See the details at the project's tracker

Please see the GitHub project for the details.
Non-maven users can download the binary distribution from Github releases.

Thanks to people who is contributing with PRs.



  1. thank you for springboot support

    I am getting below exception, when trying to connect database.
    During debugging, I have found springboot is reading properties file and created datasource successfully.
    But mybatis is throwing NPE, as environemnt is NULL, can you help resolve this issue?

    Caused by: java.lang.NullPointerException: null
    at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:95) ~[mybatis-3.4.0.jar:3.4.0]
    ... 15 common frames omitted

  2. How do I use the jsr-310 support? Using a constructor argument as in `@Arg(column = "dateLastUpdated", javaType = LocalDate.class)` fails.

    1. Ok, it's not quite "out of the box", but I have found the solution. You need to include the `mybatis-typehandlers-jsr310' dependency.


  3. Hi There,

    I am trying to use spring boot with mybatis 3.4.0 and deploy the 'WAR' file to IBM WAS

    When I start the app I get the following error for all classes in mybatis 3.4.0 jar file:

    00000099 SystemOut O 2016-06-02 19:29:29.528 WARN 16489 --- [ Default : 4] com.ibm.ws.ecs : unable to open input
    stream for resource org/apache/ibatis/javassist/util/proxy/SerializedProxy.class in archive WEB-INF/lib/mybatis-3.3.1.jar

    java.lang.RuntimeException: null
    at org.objectweb.asm.MethodVisitor.visitParameter(Unknown Source)
    at org.objectweb.asm.ClassReader.b(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:149)

  4. It works fine in Jetty Server but IBM WAS (which is JDK 1.8) I see the error s as above.

    IS there a way to resolve the above issue?

  5. when using 3.4.0 i see this:
    [2/06/16 14:24:32:172 NZST] 00000077 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Scan failure for [ o
    rg/apache/ibatis/javassist/util/proxy/SerializedProxy.class ] in [ WEB-INF/lib/mybatis-3.4.0.jar ]: [ null ]

    1. You can find a workaroud here https://groups.google.com/forum/#!topic/mybatis-user/ZhI4cPe7cq8

      Anyway I would like to ask you to open an issue to IBM and let us know about it here:https://github.com/mybatis/mybatis-3/issues/706

      And/Or in in shade's tracker: https://issues.apache.org/jira/browse/MSHADE-226

      Thanks in advance!!!

  6. In our present implementation the application is using a 3rd party cache. In order to check the performance of this interaction with the cache -- is it possible to implementation that will respond with unique data sets.