Asimov Technologies
J2EE, JEE, PHP
Frank D. Martínez’s Blog
Software & Fun
Welcome to my technical blog. Here you can find my opinions and proposals over many software development things, mainly on open source projects.
iBatis-Ext: iBatis with annotations, typed collections and interface based DAOs
I developed a very simple and small library to add some typed access to the SqlClientMap methods of the iBatis framework.
The idea is very simply:
0. Write your model POJO
See the code here
1. Write an interface and annotate it with @DAO
2. Add methods to the interface and annotate they with @SelectStatement, @UpdateStatement, ….
See the code here
3. Write the sqlmap.xml in the same package of the interface and with the same name but with extension .ibatis.xml
See the code here
4. Write your sqlMap config file and place it in the classpath.
See the code here
5. Obtain an IBatisExtSessionFactory using the static build(sqlConfig) method.
6. Create a threadsafe session using the createSession method.
7. Obtain a dao instance using the getDAO(…) method.
8. Call your dao methods.
See the code here
Download the library:
- Complete source code and Netbeans 6.0 project
- Just the jar file
- Javadoc
- Complete CRUD Sample (MySQL)
I am using this code in a project right now and works like a charm. I posted it here because maybe it can be useful for you too. Any feedback is appreciated.
This site contains personal opinions about many things and does not intend to be normative in any aspect.
Java, J2EE, J2SE, JEE, Are trademarks of Sun Microsystems Inc.