camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Data not inserted into DB (Camel Bean / EclipseLink / Spring DM / SMX 4.2) !!
Date Thu, 06 May 2010 15:24:20 GMT
Hi,

I use Camel 2.2 on SMX4.2 with Spring. I have created a route calling
a camel bean POJO exposed as a Spring DM service. Everything works
fine, no error is returned but my data are not saved in the DB.

Config : Route

	public void configure() throws Exception {
		
		onException(Exception.class).log(">> Exception raised !!");
		
		/**
		 * Route persisting objects in DB
		 */
		 from(queueValidatedUri)
		 .beanRef("sapPersistence", "save") // Reference of camel pojo bean
exposed as a OSGI Service
		 .log(">>> Message saved in the DB : ${id}") // This message appears
well into the console
		 .to(queueOutUri);
	}

Config : Spring config file of camel

    <osgi:reference id="sapPersistence"
interface="com.goodyear.emea.gicl.esb.service.Persistence"/>

Config : Camel POJO Bean

import org.apache.camel.Body;
import org.apache.camel.Exchange;
import org.springframework.transaction.annotation.Transactional;

@Transactional // Spring Annotation used to add Transactional Aspect
public class PersistenceImpl implements Persistence {
	
	private SapDocumentDAO sapDocumentDAO;

	@Transactional
	public void save(@Body FinishedTireDocument finishedTiredDocument,
Exchange ecxh) {
		
		getSapDocumentDAO().save(finishedTiredDocument);
		
	}

	public SapDocumentDAO getSapDocumentDAO() {
		return sapDocumentDAO;
	}

	public void setSapDocumentDAO(SapDocumentDAO sapDocumentDAO) {
		this.sapDocumentDAO = sapDocumentDAO;
	}
	
}

Camel Spring Config

	<tx:annotation-driven transaction-manager="txManager" />

	<osgi:reference id="txManager"
interface="org.springframework.transaction.PlatformTransactionManager"
/>

	<bean id="sapService"
class="com.goodyear.emea.gicl.esb.service.impl.PersistenceImpl">
		<property name="sapDocumentDAO">
			<osgi:reference	interface="com.goodyear.emea.gicl.esb.persistence.SapDocumentDAO"
/>
		</property>
	</bean>

	<osgi:service ref="sapService"
interface="com.goodyear.emea.gicl.esb.service.Persistence" />

In the log, I see the eclipselink trace with "select statement"

[EL Fine]: 2010-05-06
17:15:31.64--ServerSession(20460988)--Connection(15257539)--Thread(Thread[Defa
ultMessageListenerContainer-1,5,spring-osgi-extender[26807f]-threads])--SELECT
CMP_CODE, CMP_TYPE FR
OM TB_COMPOUND WHERE (CMP_CODE = ?)
        bind => [SPEC-LU-MCFB883]

but no insert when getJpaTemplate().persist() is called.

I think that the issue is related to Transaction but don't know how to
solve it ?

Kind regards,

Charles Moulliard

Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel Committer

*******************************************************************
- Blog : http://cmoulliard.blogspot.com
- Twitter : http://twitter.com/cmoulliard
- Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Mime
View raw message