MyBatis vs Spring Jdbc (JdbcTemplate) (I did a search first)

1,111 views
Skip to first unread message

Will Dev

unread,
Mar 19, 2015, 11:26:10 AM3/19/15
to mybati...@googlegroups.com
I searched the group first but could not other threads though it seemed like it must have been asked before.

What's the difference between MyBatis and Spring Jdbc? I used Hibernate at my previous job and hated how bloated it was, trying to start a new demo project for job interviews. Interested in something that would automate the repetitive tasks of copying object properties into POJO's, but otherwise be mostly sql. Seems like it's mostly between either MyBatis, or Spring Jdbc.

Anyone know of any other threads or answers that compare which one would be simpler/better?

Larry Meadors

unread,
Mar 20, 2015, 9:24:23 AM3/20/15
to mybati...@googlegroups.com
My recommendation would be to try them both in a simple 2-3 table
application and compare for yourself and write the blog post you were
looking for. :)

It'll take you a couple of hours, but at the end of it, when someone
in an interview asks you to discuss data access, you'll be able to
share that solid first-hand knowledge, not say "Well, I read that..."
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mybatis-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Daniel Guggi

unread,
Mar 20, 2015, 6:11:44 PM3/20/15
to mybati...@googlegroups.com
The answer is not "or" but "and":

not too long ago, we also replaced hibernate with mybatis "and" spring-jdbc. we decided that hiberate is waay too complex/complicated and stands in he way most of the time (imo). what i really like about mybatis is that it is not an orm :) - it maps statements to objects - so call it the "WYS(elect)IWYG" orm if you like.

Further we also do not (and neither want) use any "advanced" mybatis features like lazy-loading, caching etc (we do this at other layers). 

Mybatis is our primary solution for jdbc data access - however from time to time (regulary) there are cases where a more "low-level" approach works  better/easier - in such cases we often just use spring-jdbc (we also do not try hard to make everything work with mybatis only).

So both mybatis and spring-jdbc are great frameworks. Imho pring-jdbc is a bit more low-level and for basic day-to-day work, mybatis will be simpler to use in terms of "repetitive tasks" mentioned above. spring-jdbc on the other side is an awsome jdbc abstraction and flexible as hell. I'm happy that we have both weapons in our arsenal to tackle jdbc access :)


Will Dev

unread,
Mar 24, 2015, 8:49:01 PM3/24/15
to mybati...@googlegroups.com
Thanks for the thoughts guys. Wish there had been an existing one though... :-/

I am working on writing a sample project, I'm going to start with Spring Jdbc, so if I don't find a job right away and have time I'm going to reimplement the db layer with MyBatis and see how it goes. If I do, I'll post back.

Thanks anyways.
Reply all
Reply to author
Forward
0 new messages