Skip to main content


Showing posts from October, 2014

Spring 4 and mybatis 3 for data tier

Personally I think Hibernate has its complications and doesn't fit an enterprise SOA applications, It will need a lot of customization that will take the essence of why Hibernate is for. So I prefer to use another framework for SQL databases and it's Mybatis. Mybatis in short is an SQL mapping framework that will handle the conversion from SQL to Java and the other way around. it relies on the concept of SQL maps, which are "originally" xml files that define the mapping between our DAO methods and the queries we execute and describe the results and how they are mapped. example on a simple map : now let's see how to use this query from our java code. first we have to place our xml file in the classpath, in my case I use gradle as build system and the src/main/resources folder is the best choice for me. now in some package I should have an interface that will call this map: [