2 Replies Latest reply on Dec 1, 2009 12:17 PM by Celinio Fernandes

    Default value for transaction-type in persistence.xml

    Celinio Fernandes Novice

      Hi,

      it seems to me that there is a lot of confusion in the default value of the transaction-type attribute of the persistence-unit tag in the persistence.xml file.

      What is the default value of this file ? JTA or RESOURCE_LOCAL ?
      Does it depend on the environment : Java SE or JAVA EE ?

      That is what this documentation for Apache Geronimo states :
      http://cwiki.apache.org/GMOxDOC21/persistencexml.html


      In general, in Java EE environments, a transaction-type of RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a Java EE environment, if this element is not specified, the default is JTA. In a Java SE environment, if this element is not specified, a default of RESOURCE_LOCAL may be assumed.


      What is the behaviour of that attribute in JBoss 5.1.0 GA ?

      Thanks for enlightening me and other people i am sure.

      Celinio Fernandes

        • 1. Re: Default value for transaction-type in persistence.xml
          jaikiran pai Master

           

          "longbeach" wrote:

          That is what this documentation for Apache Geronimo states :
          http://cwiki.apache.org/GMOxDOC21/persistencexml.html

          In general, in Java EE environments, a transaction-type of RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a Java EE environment, if this element is not specified, the default is JTA. In a Java SE environment, if this element is not specified, a default of RESOURCE_LOCAL may be assumed.



          That's actually what the EJB3 Persistence Spec states too:

          "EJB3 Persistence Spec" wrote:
          6.2.1.2 transaction-type
          The transaction-type attribute is used to specify whether the entity managers provided by the entity manager factory for the persistence unit must be JTA entity managers or resource-local entity managers. The value of this element is JTA or RESOURCE_LOCAL. A transaction-type of JTA assumes that a JTA data source will be provided either as specified by the jta-data-source element or provided by the container. In general, in Java EE environments, a transaction-type of RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a Java EE environment, if this element is not specified, the default is JTA. In a Java SE environment, if this element is not specified, a default of RESOURCE_LOCAL may be assumed.



          • 2. Re: Default value for transaction-type in persistence.xml
            Celinio Fernandes Novice

            Thanks Jaikiran. That is what I read too a while ago. I guess I needed confirmation of that same behaviour in JBoss, which should be anyways, since it is JEE compliant.