Announcement Announcement Module
Collapse
No announcement yet.
Mybatis 3 + IBatis 2 + Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mybatis 3 + IBatis 2 + Spring

    Howdy,
    I have seen conflicting information about whether Spring will have support for Mybatis in 3.1. We currently have *a lot* of Ibatis 2-based code and are working on an upgrade to Spring 3.x (from 2.0.7). From a Spring-proper standpoint the upgrade was quite straightforward (thanks!), however enormous changes have happened in that time with Ibatis and now Mybatis . I began the process of upgrading all the maps and calls to conform to all the changes, but in reality there are too many changes required to do the process safely in one fell swoop. That's where I am hoping spring-orm will come to my rescue. If the Mybatis support is done in such a way that all the existing ibatis stuff works, I'll be in fat city. I can wire in the right stuff at the right place and upgrade in a slower, more-controlled fashion. That would require re-namespacing one of the projects it seems.

    So my questions are:
    * Is there really going to be Mybatis 3 support in Spring 3.1
    * Will that support maintain support for Ibatis 2?
    * Is there a timetable for Spring 3.1?
    * I hunted around, but could not easily find a place where I could see the nightlies for the 3.1 work. Is that publicly accessible?

    Thanks in advance!
    Sam

  • #2
    MyBatis 3 is a full rewrite or iBATIS from scratch. It is not backwards compatible.

    There are tools than can help you in the migration process. I used this one, and worked fine for me:
    http://code.google.com/p/mybatis/issues/detail?id=72

    I am fairly sure that Spring 3.1 will not provide MyBatis support because MyBatis team has already covered that with the integration module called MyBatis-Spring.

    I you are using DAOs in spring, you should have minor code changes. You should extend SqlSessionDaoSupport instead SqlMapClientDaoSupport and use SqlSession instead of SqlMapClient.

    For new developments I would have a look at mappers, a new feature of MyBatis that leverages DI so you can build your apps without any dependency on MyBatis. Have a look at JPetStore port to MyBatis 3 using mappers.
    http://mybatis.googlecode.com/files/...0.0-bundle.zip

    Comment


    • #3
      Thanks for the reply, mac1929

      Unfortunately, because the classes that make up MyBatis are still named/namespaced as they were from the apache Ibatis days (org.apache.ibatis.*), I can't run both at the same time (without doing something very complicated, and error prone).

      I can't reasonably convert all the SqlMaps in the project. The rote stuff the XSLT does I already did by hand, the problems are the changes to nullValue and the conditional logic (<isPropertyNull>, etc). These require human interaction to actually change each query. The risk to my business is simply too great to change all of these at once. I need a solution to be able to slowly meter these out in deployments spread out over months to reduce risk, which means I need to be able to run iBatis 2 and MyBatis 3 at the same time.

      Any assistance would be greatly appreciated,
      Sam

      Comment


      • #4
        Well, that may sound funny but iBATIS namespace is com.ibatis and MyBatis namespace (now it is no longer at apache) it is org.apache so it won't collide.

        Comment


        • #5
          Thanks, that helps a lot!

          Sam

          Comment

          Working...
          X