Understood.

Clarification (or what I meant to say), per my experience,

1. it is not necessary for 'tomee' users to add non-jta datasource in
persistence.xml
2. it is not necessary for 'tomee' users to add non-jta datasource in
tomee.xml

Why/proof? My latest/current persistence.xml includes 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>
        <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="128"
/>
        <property name="eclipselink.logging.parameters" value="false" />
        </properties>
    </persistence-unit>
</persistence>


My tomee.xml does 'not' have non-jta datasource, but when tomee (1.6.0
snapshot) is started, I see the following in the log (which tells me that
'tomee' created non-jta, since I did not specify non-jta 'anywhere' in my
app. TomEE container/committers is/are NICE!!! :)

Apr 04, 2013 1:59:55 AM org.apache.openejb.config.AutoConfig
setNonJtaDataSource
INFO: Adjusting PersistenceUnit mcmsPU <non-jta-data-source> to Resource ID
'jdbc/mcmsJtaNonJta' from 'null'


Recognize/note the word 'adjusting' in the log above. :)



On Thu, Apr 4, 2013 at 9:29 AM, Romain Manni-Bucau <rmannibu...@gmail.com>wrote:

> both are necessary since years since the jpa provider can use both (for
> action not in a JTA context for instance). OpenJPA needs it for instance.
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/4/4 Howard W. Smith, Jr. <smithh032...@gmail.com>
>
> > On Thu, Apr 4, 2013 at 7:36 AM, mauro2java2011 <mauro2java2...@gmail.com
> > >wrote:
> >
> > > I have also to declare always the resource for non jta datasource with
> > jta
> > > false ?
> > > Whi into petsistece.xml ir is necessary to specify bot jta-datasource
> and
> > > nojtA-datasource?
> > >
> > >
> > From what I understand, it is no longer necessary to set 'both' jta and
> > non-jta datasource in persistence.xml. no longer necessary = 1.5.2 or
> 1.6.0
> > snapshot. If you're using 1.5.1, then it 'may' be necessary, but I don't
> > know. I don't use the 'release', I use 'snapshot'...always (since
> > 'snapshot' = 'latest version').
> >
> >
> >
> > > What it is the difference from the datasource pooled getting from
> normal
> > > tomcat  ? I refer to datasource fir poolig connection thar into tomcat
> i
> > > declare into context.xml and i refer it into web.xml into reference ??
> > >
> > >
> > I will let Romain reply to this. I think tomee.xml is recommended, and in
> > my case, context.xml and web.xml is not necessary.
> >
>

Reply via email to