You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2016/01/18 10:57:39 UTC

[jira] [Commented] (ARIES-1432) EMFTracker getTransactionType() method always returns PersistenceUnitTransactionType.JTA

    [ https://issues.apache.org/jira/browse/ARIES-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15105033#comment-15105033 ] 

Christian Schneider commented on ARIES-1432:
--------------------------------------------

This is only for the karaf tests. 

The main itests also cover the RESOURCE_LOCAL case.
See https://github.com/apache/aries/blob/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml

You should be able to add a test based on this persistence unit in https://github.com/apache/aries/tree/trunk/jpa/itests/jpa-container-itest


> EMFTracker getTransactionType() method always returns PersistenceUnitTransactionType.JTA
> ----------------------------------------------------------------------------------------
>
>                 Key: ARIES-1432
>                 URL: https://issues.apache.org/jira/browse/ARIES-1432
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: jpa-2.1.0, jpa-2.3.0
>            Reporter: Tim
>            Priority: Minor
>
> It looks as though the EMFTracker getTransactionType() method is not working correctly, it always returns a PersistenceUnitTransactionType.JTA regardless of the transaction-type (JTA or RESOURCE_LOCAL). Consequently the ResourceLocalJpaTemplate is never instantiated if RESOURCE_LOCAL is specified in the persistence.xml.
> I could probably help if I knew where/why the logic for retrieving the PersistenceUnitTransactionType from the properties of the EntityManagerFactory came from?
> The bundles I installed were
> feature:install scr
> feature:install jpa/2.1.0
> feature:install hibernate/4.3.6.Final
> feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.7.0/xml/features
> feature:install pax-jdbc-h2
> feature:install transaction
> feature:install pax-jdbc-pool-dbcp2
> feature:install pax-jdbc-config
> service:list javax.sql.DataSource
> bundle:install -s mvn:net.lr.tasklist.ds/tasklist-model/1.0.0-SNAPSHOT
> bundle:install -s mvn:net.lr.tasklist.ds/tasklist-persistence/1.0.0-SNAPSHOT
> feature:install http-whiteboard
> feature:install persistence-api
> bundle:install -s mvn:net.lr.tasklist.ds/tasklist-ui/1.0.0-SNAPSHOT
> with a config
> osgi.jdbc.driver.name=H2-pool
> url=jdbc:h2:mem:test
> user=sa
> password=
> dataSourceName=tasklist
> 1) If the transaction-type="JTA" in persistence.xml (even though osgi.jdbc.driver.name=H2-pool) the tasklist tests will appear to work e.g. another task can be saved. However I modified the test to insert 2 tasks within one lambda expression and throw a Runtime exception after the first task insertion, expected result would be that the first insertion is rolled back, however it was committed.
> 2) If the transaction-type="RESOURCE_LOCAL" in persistence.xml the following exception is thrown (note the presence of XAJpaTemplate rather than ResourceLocalJpaTemplate)
> java.lang.RuntimeException: java.lang.RuntimeException: javax.persistence.TransactionRequiredException: no transaction is in progress
> 	at org.apache.aries.jpa.support.impl.XAJpaTemplate.txExpr(XAJpaTemplate.java:62)
> 	at org.apache.aries.jpa.support.impl.AbstractJpaTemplate.tx(AbstractJpaTemplate.java:32)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)