camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Webb <>
Subject Spring/Hibernate and transactions
Date Wed, 01 Dec 2010 21:38:48 GMT
I have a simple route that receives messages, converts them to an
@Entity class and attempts to write the data to a database.  I would
like to use Spring/Hibernate to perform this task along with a
TransactionManager.  I have been reading through the Camel In Action
chapter #9 and following the example.  From what I can tell, I should
be using JDBC, but should there be a different if I want to use Spring
and Hibernate?  In my activemq.xml file I import a file where I have
my camel routes and other beans defined.  In this file I have the

    <bean id="jmsConnectionFactory"
        <property name="brokerURL" value="tcp://" />

    <bean id="activemq"
        <property name="transacted" value="true" />
        <property name="transactionManager" ref="txManager" />

    <bean id="txManager"
        <property name="connectionFactory" ref="jmsConnectionFactory" />

	<bean name="jms" class="org.apache.camel.component.jms.JmsComponent">
		<property name="connectionFactory" ref="jmsConnectionFactory" />

Just like what is in the book.  In another file I have my
hibernate.cfg.xml file which lists the connection information required
to connect to the database.  When I run my code, the processor that is
performing the database inserts is not throwing errors, but the code
is not getting into the database.  This leads me to believe that the
inserts are happening, but the data is not in the database.  I can
query the data and results come back.  So can someone please help me
as to what I am doing wrong?  Here is a snippet of logging when
ActiveMQ starts up:

 INFO | autocommit mode: false
 INFO | using driver: org.postgresql.Driver at URL:
 INFO | connection properties: {user=xxxxx, password=****}
 INFO | RDBMS: PostgreSQL, version: 8.4.5
 INFO | JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.4
JDBC4 (build 702)
 INFO | Using dialect: org.hibernate.dialect.PostgreSQLDialect
 INFO | Using default transaction strategy (direct JDBC transactions)
 INFO | No TransactionManagerLookup configured (in JTA environment,
use of read-write or transactional second-level cache is not
 INFO | Automatic flush during beforeCompletion(): disabled
 INFO | Automatic session close at end of transaction: disabled
 INFO | JDBC batch size: 15
 INFO | JDBC batch updates for versioned data: disabled
 INFO | Scrollable result sets: enabled
 INFO | JDBC3 getGeneratedKeys(): enabled
 INFO | Connection release mode: auto
 INFO | Default batch fetch size: 1
 INFO | Generate SQL with comments: disabled
 INFO | Order SQL updates by primary key: disabled
 INFO | Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
 INFO | Using ASTQueryTranslatorFactory
 INFO | Query language substitutions: {}
 INFO | JPA-QL strict compliance: disabled
 INFO | Second-level cache: enabled
 INFO | Query cache: disabled
 INFO | Cache provider: org.hibernate.cache.NoCacheProvider
 INFO | Optimize cache for minimal puts: disabled
 INFO | Structured second-level cache entries: disabled
 INFO | Statistics: disabled
 INFO | Deleted entity synthetic identifier rollback: disabled
 INFO | Default entity-mode: pojo
 INFO | building session factory
 INFO | Not binding factory to JNDI, no JNDI name configured

View raw message