Using Apache Camel with Ibatis

2008-10-08

This is a quick tutorial about the usage of the very powerful Integration tool Apache Camel with Apache Ibatis. Many thanks to Apache Camel forums and Claus Ibsen.

REQUIREMENTS

  • I used Java version 1.5.0_16
  • Apache Maven version 2.0.9
  • A database mysql: I used a local db “moodle”, user “moodle”, password “moodle” and a table “mdl_user” [ create table mdl_user ( id int, firstname varchar(30), lastname varchar(30), email varchar(30) ); ]

DOWNLOAD

The full sample project can be download from here!

STEP BY STEP

As suggested by http://activemq.apache.org/camel/creating-a-new-spring-based-camel-route.html matteo@nowar:~/workspace$ mvn archetype:create \ -DarchetypeGroupId=org.apache.camel \ -DarchetypeArtifactId=camel-router \ -DarchetypeVersion=1.4.0 \ -DgroupId=org.redaelli \ -DartifactId=demo-ibatis matteo@nowar:~/workspace$ cd demo-ibatis matteo@nowar:~/workspace$ mvn eclipse:eclipse matteo@nowar:~/workspace$ mvn install Create iBatis files

  • src/main/resources/SqlMapConfig.xml
  • src/main/resources/User.xml
  • src/main/java/org/redaelli/User.java

Add the routes and dependences in the files

  • src/main/java/org/redaelli/MyRouteBuilder.java
  • pom.xml (adding dependencies “camel-ibatis” e “mysql jdbc”)

And finally run the demo with matteo@nowar:~/workspace$ mvn camel:run


Enter your instance's address


More posts like this