camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chanducompute <chanducomp...@yahoo.co.in>
Subject Not able to update entity using Camel JPA
Date Fri, 25 Jul 2014 07:42:52 GMT
Hi,

I am using cmael JPA for my persistence operations,and as part of my updates
I am facing issues.

In my route I am reading a row and then modifying it in a bean and adding to
JPA:entity and getting errors.

here is my route
from("jpa:test.persistence.entity.StatusCodeMappings?consumer.namedQuery=StatusCodeMappings.findById&consumer.delay=50000000&consumeLockEntity=false&consumeDelete=false")
	.log("First Route==>${body}").to("direct:updateExistData");
from("direct:updateExistData").beanRef("mappingsLoader",
"updateExistStatusCodeMappings")
	.log("This is after modification==>${body}").to("jpa:entity");

Here is the update entity logic
mappings.setStatusCode(7);
mappings.setAlertName("Updated one is the one");
mappings.setSeverity(1);

Below is the error I am getting.
2014-07-25 13:12:10,560 WARN  [org.apache.camel.component.jpa.JpaConsumer]
(Camel (OpsCamelContext) thread #0 -
jpa://com.nielsen.engineering.mediaworks.example.jee6.lib.persistence.entity.StatusCodeMappings)
Consumer
Consumer[jpa://com.nielsen.engineering.mediaworks.example.jee6.lib.persistence.entity.StatusCodeMappings?consumeDelete=false&consumeLockEntity=false&consumer.delay=50000000&consumer.namedQuery=StatusCodeMappings.findAll]
failed polling endpoint:
Endpoint[jpa://com.nielsen.engineering.mediaworks.example.jee6.lib.persistence.entity.StatusCodeMappings?consumeDelete=false&consumeLockEntity=false&consumer.delay=50000000&consumer.namedQuery=StatusCodeMappings.findAll].
Will try again at next poll. Caused by:
[javax.persistence.PersistenceException -
org.hibernate.exception.GenericJDBCException: could not perform addBatch]:
javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: could not perform addBatch
	at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
[hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
[hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316)
[hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:999)
[hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[rt.jar:1.7.0_51]
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[rt.jar:1.7.0_51]
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.7.0_51]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
	at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
[spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at com.sun.proxy.$Proxy168.flush(Unknown Source)
	at
org.apache.camel.component.jpa.JpaConsumer$1.doInTransaction(JpaConsumer.java:124)
[camel-jpa-2.12.2.jar:2.12.2]
	at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
[spring-tx-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:80)
[camel-jpa-2.12.2.jar:2.12.2]
	at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
[camel-core-2.12.2.jar:2.12.2]
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
[camel-core-2.12.2.jar:2.12.2]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[rt.jar:1.7.0_51]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
[rt.jar:1.7.0_51]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
[rt.jar:1.7.0_51]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[rt.jar:1.7.0_51]
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[rt.jar:1.7.0_51]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[rt.jar:1.7.0_51]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: org.hibernate.exception.GenericJDBCException: could not perform
addBatch
	at
org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:114)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:101)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:149)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch(JdbcCoordinatorImpl.java:198)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:357)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:328)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)
[hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:996)
[hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
	... 18 more
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Timeout trying to lock
table ; SQL statement:
update opsBridge.status_codes set alert_name=?, severity=?, status_code=?
where status_code_id=? [50200-168]



Can some one please help me resolving this.




Thanks,
Chandu.



--
View this message in context: http://camel.465427.n5.nabble.com/Not-able-to-update-entity-using-Camel-JPA-tp5754434.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message