openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: OpenJPA and auto-commit
Date Mon, 01 Dec 2014 22:31:22 GMT
Hi Charlie,
Most of my experience is in the Java EE space, not the OSGi/Aries
environment.  Since WebSphere is using both Aries and OpenJPA, and
WebSphere supports both Java EE and OSGi programming models, you should be
able to get this combination to work.  I'm just not sure what, if any,
additional magic WebSphere had to include...  Have you been posting on the
Aries site as well?

Good luck,
Kevin

On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cmordant1@gmail.com> wrote:

> Hi Kevin,
>
> I removed the non-jta-datasource (referencing the same connection) because
> I thought it was the issue (and that was failing the same way).
> Even if I add it, it also fails (randomly, sometimes it passes).
>
> I’m not sure it is really OpenJpa related, as I’m using Aries-JPA/Tx,
> Pax-JDBC.
> I’m currently investigating, and if you’ve any other pointers I’ll sure
> try :).
>
> Thank you, and best regards,
>
> Charlie
>
> PS: if you’re also interested in the case, you can also try to see where’s
> the catch compiling this:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it will
> once on three times fail on the hello sample blueprint test).
>
> > Le 1 déc. 2014 à 22:41, Kevin Sutter <kwsutter@gmail.com> a écrit :
> >
> > 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 <cmordant1@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/(&amp;(
> >> 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
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message