You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

iBATIS

The ibatis: component allows you to query, poll, insert, update and delete data in a relational database using Apache iBATIS.

URI format

ibatis:operationName

Where operationName is the name in the iBATIS XML configuration file which maps to the query, insert, update or delete operation you wish to evaluate.

Options

None

Samples

For example if you wish to consume beans from a JMS queue and insert them into a database you could do.

from("activemq:Some.Queue").
  to("ibatis:insertAccount");

Where insertAccount is the iBatis id in the SQL map file:

  <!-- Insert example, using the Account parameter class -->
  <insert id="insertAccount" parameterClass="Account">
    insert into ACCOUNT (
      ACC_ID,
      ACC_FIRST_NAME,
      ACC_LAST_NAME,
      ACC_EMAIL
    )
    values (
      #id#, #firstName#, #lastName#, #emailAddress#
    )
  </insert>

Scheduled polling example

Since this component does not support scheduled polling you need to use another mechanism for triggering the scheduled pools such as the Timer or Quartz components.

In the sample below we poll the database using the Timer component:

TODO: snippet e1

  • No labels