Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc
Available as of Camel 2.11
This example is located in the
The source code for this example can be viewed online at this link
If you use maven then you can easily compile and install the example from the command line:
This example shows how to exchange data using a shared database table.
The example has two Camel routes. The first route insert new data into the table, triggered by a timer to run every 5th second.
And in the same file we setup Hibernate. At first we have the Camel Hibernate component, and then a number of beans to setup transactions. And then the last bean setup the Hibernate session factory where we refer to the data source and the hibernate mapping files, and any other hibernate configurations we may need.
And then in the same file we setup our Camel application. At first we have a orderBean that we use in the routes to generate new orders and process orders as well.
Hibernate mapping and POJO beans
In this example we have a Order POJO in the class
The Order pojo is mapped to Hibernate using the mapping file
Running the example
This example can be run from the command line
Press ctrl + c to stop the example.
When running this example you should see logging in the console about orders being processed, for example as shown below: