Hi Charlie, Since you are using SynchronizeMappings, you should be providing an alternate datasource (non-jta-data-source) in addition to the jta-data-source. OpenJPA requires access to the database in order to define or adjust your schemas based on your Entity definitions. Without a non-jta-data-source, OpenJPA will attempt to do this work within the global transaction. Unfortunately, the auto commit processing doesn't work well within a global transaction (as you have found out).
Hope this helps. Kevin On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <cmorda...@gmail.com> wrote: > Hi OpenJPA Guru's, > > I'm encountering an issue when openJPA participates to a global > transaction, I've got this weird error happening sometimes: > > Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error> > org.apache.openjpa.persistence.PersistenceException: > setAutoCommit(true) invalid during global transaction. > > at > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559) > > at > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455) > > > My persistence.xml is as simple as it can be: > [code] > > <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA"> > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > <jta-data-source>osgi:service/javax.sql.DataSource/(&( > osgi.jndi.service.name > =${project.parent.artifactId}.database)(aries.managed=true))</ > jta-data-source> > > <properties> > > <property name="openjpa.Log" value="slf4j"/> > > <property name="openjpa.jdbc.SynchronizeMappings" value= > "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/> > > <property name="openjpa.jdbc.DBDictionary" value="derby"/> > > </persistence-unit> > [/code] > > Is there any property/option to set somewhere? > > Regards, > > -- > Charlie Mordant > > Full OSGI/EE stack made with Karaf: > https://github.com/OsgiliathEnterprise/net.osgiliath.parent >