I don't really know the reason but looking at the stacktrace it's either
OpenJPA or the JDBC driver itself who decides to set autocommit (which
whon't work) in a transaction.



2016-07-11 11:18 GMT+02:00 Christian Schneider <[email protected]>:

> Hmm ... honestly I do not know. Why does creating the mappings not work in
> a a transaction?
>
> Christian
>
>
> On 11.07.2016 11:14, Bengt Rodehav wrote:
>
> But isn't the whole idea with providing both a <jta-datasource> and a
> <non-jta-datasource> that the latter can be used for example when creating
> the database schema outside of any transaction? My persistence.sql looks
> like this:
>
> *<?xml version="1.0" encoding="UTF-8"?>*
> *<persistence xmlns="http://java.sun.com/xml/ns/persistence
> <http://java.sun.com/xml/ns/persistence>"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> <http://www.w3.org/2001/XMLSchema-instance>"*
> *  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> <http://java.sun.com/xml/ns/persistence>
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
> <http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd>"*
> *  version="2.0">*
> *  <persistence-unit name="filetransferhistoryPU" transaction-type="JTA">*
> *
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>*
> *
> <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
> <http://osgi.jndi.service.name>=jdbc/filetransferhistory)</jta-data-source>*
> *
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
> <http://osgi.jndi.service.name>=jdbc/filetransferhistorynojta)</non-jta-data-source>*
> *    <class>se.digia.connect.filetransfer.history.domain.Entry</class>*
> *    <class>se.digia.connect.filetransfer.history.domain.FileEntry</class>*
> *    <class>se.digia.connect.filetransfer.history.domain.Retry</class>*
> *    <class>se.digia.connect.util.persistence.EntityBase</class>*
> *    <exclude-unlisted-classes>true</exclude-unlisted-classes>*
> *    <validation-mode>NONE</validation-mode>*
> *    <properties>*
> *      <property name="openjpa.ConnectionFactoryMode" value="managed" />*
> *      <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" />*
> *      <property name="openjpa.jdbc.DBDictionary" value="derby" />*
> *      <property name="openjpa.jdbc.UpdateManager" value="operation-order"
> />*
> *      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"
> />*
> *    </properties>*
> *  </persistence-unit>*
> *</persistence>*
>
> The "..SynchronizeMappings" should be used outside JTA transactions using
> auto commit. How could this ever work with JPA Blueprint then?
>
> /Bengt
>
> 2016-07-11 11:10 GMT+02:00 Christian Schneider <[email protected]>:
>
>> This is decided by Aries JPA. If you use transaction-type="JTA" then the
>> jta-datasource is used else the non-jta-datasource.
>>
>> Christian
>>
>> On 11.07.2016 11:03, Bengt Rodehav wrote:
>>
>> I think the important question is: *Who* determines whether to use the
>> <jta-datasource> or the <non-jta-datasource>?
>>
>> The follow-up question would be: *What criteria* is being used to choose
>> between them?
>>
>> /Bengt
>>
>>
>> --
>> Christian Schneiderhttp://www.liquid-reality.de
>>
>> Open Source Architecthttp://www.talend.com
>>
>>
>
>
> --
> Christian Schneiderhttp://www.liquid-reality.de
>
> Open Source Architecthttp://www.talend.com
>
>

Reply via email to