On Thu, Apr 4, 2013 at 7:07 AM, Romain Manni-Bucau <[email protected]>wrote:

>
> about the jta datasource define a datasource in tomee.xml with JtaManaged =
> true and check you rpersistence.xml is of transaction-type = JTA
>
>
For an example of what Romain is talking about above, see below (copied and
pasted from an older mail thread, where this was discussed earlier.

I am specifying my datasource(s) in tomee.xml, it references the
jta-data-source name as defined inpersistence.xml. I would assume this is
sufficient to specify as many persistence providers inpersistence.xml and
as many resources in tomee.xml which reference jta-data-source name's
defined in persistence.xml.

So, my tomee.xml contains the following:

<Resource id="jdbc/mcmsJta" type="javax.sql.DataSource">
  JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
  JdbcUrl jdbc:derby:C:/javadb/databases/mcmsdev;create=true
  UserName ...
  Password ...
  JtaManaged true
  jmxEnabled true
  LogSql false
  InitialSize 10
  MaxActive 100
  MaxIdle 30
  MaxWait 10000
  minIdle 10
  suspectTimeout 60
  removeAbandoned true
  removeAbandonedTimeout 180
  timeBetweenEvictionRunsMillis 30000
  jdbcInterceptors=StatementCache(max=128)
</Resource>


and persistence.xml contains the following:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns="http://java.sun.com/xml/ns/persistence";
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
    <persistence-unit name="mcmsPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/mcmsJta</jta-data-source>
        <non-jta-data-source>jdbc/mcmsNonJta</non-jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
        <property name="eclipselink.target-database"
                  value="org.eclipse.persistence
.platform.database.DerbyPlatform"/>
        <property name="eclipselink.jdbc.cache-statements" value="true" />
        <property name="eclipselink.jdbc.cache-statements.size" value="100"
/>
        <property name="eclipselink.logging.parameters" value="false" />
        </properties>
    </persistence-unit>
</persistence>


I'm sure you will find earlier topics discussed in this list, if you go to
google and search for:

tomee.xml  resource persistence.xml JTA openejb

Reply via email to