atom feed4 messages in org.apache.incubator.aries-userRE: Transactions with Blueprint
FromSent OnAttachments
Dutertry NicolasFeb 24, 2014 5:00 am 
David JencksFeb 24, 2014 10:54 am 
Dutertry NicolasFeb 25, 2014 8:12 am 
David JencksFeb 25, 2014 3:58 pm 
Subject:RE: Transactions with Blueprint
From:Dutertry Nicolas (
Date:Feb 25, 2014 8:12:04 am

Actually Geronimo transaction manager is embedded in aries transaction manager

I have finally managed to have a non-XA datasource properly handled by JTA. To
do so, I have used BasicManagedDataSource from commons dbcp. The datasource can be configured like that with blueprint:

<reference id="transactionManager"

<bean id="dataSource"
class="org.apache.commons.dbcp.managed.BasicManagedDataSource"> <property name="transactionManager" ref="transactionManager"/> <property name="driverClassName" value="org.hsqldb.jdbc.JDBCDriver"/> <property name="url" value="jdbc:hsqldb:mem:test"/> <property name="username" value="sa"/> <property name="password" value=""/> </bean>


-----Original Message----- From: David Jencks [] Sent: lundi 24 février 2014 19:54 To: Subject: Re: Transactions with Blueprint

I don't know what you are using to support jta and connection management. In
order to use jta + a non-xa-datasource you need a connection manager that knows
how to do this and it needs to be configured properly. The geronimo connection
manager does this but I don't know if its installed secretly in the aries jta

If you use an xa datasource you'll still only get one phase commit since there
is only one participant, so if the driver is written reasonably it should be as
fast as a non-xa datasource. (the "start transaction" xa message would be
replaced by "auto commit off" for a non-xa datasource. Of course this might not
result in a message to the server, depending on how the driver is written).

On Feb 24, 2014, at 5:00 AM, Dutertry Nicolas <>


I am trying to use transactions (JTA) and JPA with Aries blueprint but I did not
manage to make it work.

I don't want to use XA datasource because I only access a single database. So In
my JPA persistence.xml file I have something like : <persistence-unit name="test">

<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service. name=jdbc/testdb)</jta-data-source> ...

My blueprint.xml contains : <bean id="personService" class="test.service.impl.PersonServiceImpl"> <tx:transaction method="*" value="Required"/> <jpa:context property="entityManager" unitname="test"/> </bean>

I have written a test to check transaction's rollback, using a transactional
method like the following :

public class PersonServiceImpl implements PersonService { ... public void createPerson(Person person) { entityManager.persist(person); entityManager.flush();

throw new RuntimeException("exception"); } }

I was expecting that the created person would not be written to the database
after calling "createPerson" because of the Exception, but it is not the case !
The person object is persisted in the database. It appears that the underlying JDBC Connection has an autocommit property set to
"true", so rollback is impossible. I thought transaction manager would take care
of JDBC connection autocommit, but it is not the case.

The result is the same with OpenJPA and Hibernate.

Am I missing something related to JTA ?

Thanks for your help.