a full ibatis example?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

a full ibatis example?

Matteo Redaelli
Ciao,

I would like to use spring & camel & iBatis starting from http://activemq.apache.org/camel/creating-a-new-spring-based-camel-route.html (and in the future with smx4/osgi)

From
* http://activemq.apache.org/camel/ibatis.html an
* iBaris documentation ( iBATIS-SqlMaps-2-Tutorial_en.pdf, ..)

I read that I need to create/modify one or more xml file for ibatis configuration, database connection, sql statements,.. But I don't know in which directory. The Database connection parameters in the spring file? Can anyone help me?
 
It would be nice to have a full example as tutorial or in the example directory

Thanks in advance
Matteo
Reply | Threaded
Open this post in threaded view
|

RE: a full ibatis example?

Claus Ibsen
Hi

It is usually a good idea to check out the camel unit test of the component itself.

See the source code here:
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-ibatis/src/test/

There is a working example with ibatis sql map files that are used in the unit testing.


If you feel for it we love contributions and you could write a tutorial how to use it and we can add it to our existing documentation
http://activemq.apache.org/camel/contributing.html


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Reda [mailto:[hidden email]]
Sent: 28. september 2008 10:59
To: [hidden email]
Subject: a full ibatis example?


Ciao,

I would like to use spring & camel & iBatis starting from
http://activemq.apache.org/camel/creating-a-new-spring-based-camel-route.html

From
* http://activemq.apache.org/camel/ibatis.html an
* iBaris documentation ( iBATIS-SqlMaps-2-Tutorial_en.pdf, ..)

I read that I need to create/modify one or more xml file for ibatis
configuration, database connection, sql statements,.. But I don't know in
which directory. The Database connection parameters in the spring file? Can
anyone help me?
 
It would be nice to have a full example as tutorial or in the example
directory

Thanks in advance
Matteo
--
View this message in context: http://www.nabble.com/a-full-ibatis-example--tp19709868s22882p19709868.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

RE: a full ibatis example?

Matteo Redaelli
Thanks for your suggestion. If I was able to build a working example I would create a tutorial..;-) But I need more help.

I think I should add in camel-context the relationship between the following route and the iBatis configuration SqlMapConfig.xml

        from("timer://pollTheDatabase?delay=10000").
        to("ibatis:selectAllUsers").
        bean(new SomeBean());


My project layout is the following

src/main/java/org/apache/camel/example/spring/MyRouteBuilder.java
src/main/java/org/apache/camel/example/spring/User.java
src/main/resources/pirelli/elearning/ibatis/User.xml
src/main/resources/META-INF/spring/camel-context.xml
src/main/resources/SqlMapConfig.xml
src/main/resources/log4j.properties
Reply | Threaded
Open this post in threaded view
|

RE: a full ibatis example?

Claus Ibsen
Hi

Camel will by default look for SqlMapConfig.xml in the root classpath. So you can copy it to src/main/resources

But if you want to provide a "relationship" then you actually need to use the IBatisComponent where it has a setter method.

You can define the component in your spring xml

<bean id="ibatis" class="org.apache....IBatisComponent">
    <property name="sqlMapResource" value="classpath:WhereIsMyFile.xml"/>
</bean>

The type of sqlMapResource is a spring io Resource so you can have the classpath or filepath prefix.


Could you try it out and report how it goes. Then I can update our wiki documentation for ibatis:
http://activemq.apache.org/camel/ibatis.html


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Reda [mailto:[hidden email]]
Sent: 7. oktober 2008 14:36
To: [hidden email]
Subject: RE: a full ibatis example?


Thanks for your suggestion. If I was able to build a working example I would
create a tutorial..;-) But I need more help.

I think I should add in camel-context the relationship between the following
route and the iBatis configuration SqlMapConfig.xml

        from("timer://pollTheDatabase?delay=10000").
        to("ibatis:selectAllUsers").
        bean(new SomeBean());


My project layout is the following

src/main/java/org/apache/camel/example/spring/MyRouteBuilder.java
src/main/java/org/apache/camel/example/spring/User.java
src/main/resources/pirelli/elearning/ibatis/User.xml
src/main/resources/META-INF/spring/camel-context.xml
src/main/resources/SqlMapConfig.xml
src/main/resources/log4j.properties

--
View this message in context: http://www.nabble.com/a-full-ibatis-example--tp19709868s22882p19857166.html
Sent from the Camel - Users mailing list archive at Nabble.com.