[
https://issues.apache.org/jira/browse/ARIES-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14958260#comment-14958260
]
Tim commented on ARIES-1432:
----------------------------
I have made some progress in fixing this issue.
I am not sure about removing the ability to specify RESOURCE_LOCAL?
We currently use RESOURCE_LOCAL with a
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean and
org.springframework.orm.jpa.JpaTransactionManager (Karaf/Felix/SpringDM).
----------------------------------------------------
7.5 Controlling Transactions
(http://download.oracle.com/otn-pub/jcp/persistence-2_1-fr-eval-spec/JavaPersistence.pdf?AuthParam=1444880971_c87c2831c91613a1baef86f0c6985c8b)
"A container-managed entity manager must be a JTA entity manager. JTA entity
managers are only specified for use in Java EE containers.
An application-managed entity manager may be either a JTA entity manager or a
resource-local entitymanager.
Both JTA entity managers and resource-local entity managers are required to be
supported in Java EE web containers and EJB containers"
You will no doubt understand this better than I but I interpret this to mean it
must be JTA if the entity manager is container-managed. Is the entity manager
always managed by the container for the Aries JPA project? If so then I suppose
support for RESOURCE_LOCAL should be dropped.
> 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)