responses inline below...

On Wed, Jun 5, 2013 at 8:27 PM, Andrew Clarke <[email protected]> wrote:

>
> persistence.xml:
>
> <persistence 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_1_0.xsd"; version="1.0">
>     <persistence-unit name="ExampleEngine">
>         <provider>org.hibernate.ejb.HibernatePersistence</provider>
>         <class>com.example.account.Application</class>
>
>         <properties>
>             <property name="hibernate.show_sql" value="true"/>
>             <property name="hibernate.format_sql" value="true"/>
>             <property name="hibernate.hbm2ddl.auto" value="update"/>
>         </properties>
>     </persistence-unit>
> </persistence>
>
>
When I started using TomEE+, I was instructed (or I had) to add
jta-data-source and non-jta-data-source names to persistence.xml, but one
of the later releases of TomEE+, it was no longer necessary to add
non-jta-data-source name. See my persistence.xml below (yes, I'm using
derby and not using hibernate).

<?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>
    <class>jpa.entities.PaymentNotes</class>
    <class>jpa.entities.Payment</class>
    <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>

and below, I see you have 'JtaManaged true', which is all good, so I think
it is necessary for you to add jta db name in your persistence.xml.


>
> tomee.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <tomee>
>         <Resource id="example_db_prod" type="DataSource">
>                         JdbcDriver  com.mysql.jdbc.Driver
>                         JdbcUrl
> jdbc:mysql://localhost:3306/example_db_prod?autoReconnect=true
>                         UserName myusername
>                         Password mypassword
>                         validationQuery = SELECT 1
>                         JtaManaged true
>         </Resource>
> </tomee>
>
>

Reply via email to