Hi Check out the source and test code for camel-jpa https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test/
Generally JPA is very often complex and overkill for simple integration works where you need to work with a few tables. So consider twice if you really want to impose the complexity and overhead of using JPA. On Wed, Jan 6, 2010 at 7:53 AM, vcheruvu <[email protected]> wrote: > > Hi Camel-Users, > > Can anyone give any hints on using @Consumed annotation. I have written a > sample application where > > 1. Polling JPAConsumer endpoint gets new record > 2. Message translation using Bean Integration to invoke the method. > > 3. Work in progress - I am trying to figure out how to use @Consumed to mark > that the row has been processed so it won't be queried again. Any hints or > guidance on using @Consumed will be greatly appreciated.. > ++++++ RouteBuilder +++++++ > public class testRouter extends SpringRouteBuilder { > @Override > public void configure() throws Exception { > // the following will dump the database to files > > from("jpa:com.test.entity.OldTableEntity?consumeDelete=false&delay=3000&consumeLockEntity=false") > .to("bean:testTransformerBean?method=checkIfLookupValueExist"); > > > } > } > > ++++++++++++ > +++++Entity class ++++ > > @Entity > @Table(name = "test_table") > public class OldTableEntity { > @Column(name ="displayID") > private String displayID; > �...@column(name ="userName") > private String userName; > �...@column(name ="ordType") > > ... > getter and setters... > } > > ++++++++++++++ > +++++ camel context ++++++++ > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> > <package>com.test</package> > </camelContext> > <bean id = "testTransformerBean" class > ="com.test.transformation.testTransformer"/> > > <bean id="transactionTemplate" > class="org.springframework.transaction.support.TransactionTemplate"> > <property name="transactionManager"> > <bean class="org.springframework.orm.jpa.JpaTransactionManager"> > <property name="entityManagerFactory" ref="entityManagerFactory"/> > </bean> > </property> > </bean> > > <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate"> > <property name="entityManagerFactory" ref="entityManagerFactory"/> > </bean> > > <bean id="entityManagerFactory" > class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> > <property name="persistenceUnitName" value="camel"/> > </bean> > > > </beans> > > +++ > > Kind regards, > -Vid- > -- > View this message in context: > http://old.nabble.com/%40Consumed-tp27026797p27026797.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
