Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a Java application (an ERP) that has grown pretty large, and will continue to grow for the next couple of years. We have been using Spring-JDBC for our DAO layer. But the amount of boilerplate code that needs to be written is slowing us down significantly, not to mention introducing silly bugs in the system.

So now we're looking for a solution that will:

  • Reduce the amount of time we need to spend on the DAO layer

  • Doesn't have a very steep learning curve

  • Gives us control over our queries, like we have with JDBC.

  • We should be able port our existing code part-by-part, not all at once.

I thought MyBatis would be a good choice, but I'm not sure if it would satisfy all our requirements. In particular, would it be able to work alongside our Spring-JDBC code without creating problems in transaction management, handling concurrency etc?

Edit: Forgot to mention that we're using Spring-AOP for transaction management, which we'd prefer to continue with.


share|improve this question
up vote 1 down vote accepted

Our apps use Spring and iBatis everything. (well 99% of everything else, we still have some jdbc code that hasn't been ported yet). We are also using Spring AOP for txn managment.

In short, MyBatis+Spring AOP will work for you. It also works well with DBUnit for DAO integration testing.

share|improve this answer

MyBatis is good solution of given problems.

You can still use spring-aop with MyBatis as like in spring-jdbc.

It will take so very less, to migrate your queries from Spring-JDBC to MyBatis. MyBatis is very easy to learn and provides Object mappers to automatic convert native SQL query data to pojos. If you are using spring-jdbc, you already have java beans, those you can reuse with MyBatis.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.