users@glassfish.java.net

Re: EE5 JPA with JTA/UserTransaction -- non-Container managed transactions

From: emiddio-frontier <emiddio_at_frontier.com>
Date: Sun, 12 Dec 2010 23:02:12 -0800

thanks -- sounds like i need to study the EE[56] Spec.

gary

----- Original Message -----
From: "Sahoo" <sanjeeb.sahoo_at_oracle.com>
To: <users_at_glassfish.java.net>
Cc: "emiddio-frontier" <emiddio_at_frontier.com>; <nbj2ee_at_netbeans.org>;
<users_at_glassfish.dev.java.net>
Sent: Sunday, December 12, 2010 8:49 PM
Subject: Re: EE5 JPA with JTA/UserTransaction -- non-Container managed
transactions


>
> On Monday 13 December 2010 09:36 AM, emiddio-frontier wrote:
>> so how to do it with JNDI --i have not seen the way to do it ??? what is
>> the
>> name to lookup???
>>
>> my persistence.xml says:
>> <persistence-unit name="EmployeeService" transaction-type="JTA" >
>> ...
>>
> You need to define a <persistence-unit-ref> entry in your EE deployment
> descriptor and then you will be able to look up. See chapter 5 of EE
> platform spec or do some search in the net.
>>
>>
>> and the API for javax.persistence.Persistence says:
>> public class Persistenceextends java.lang.ObjectBootstrap class that is
>> used to obtain an EntityManagerFactory in Java SE environments.
>>
>> The Persistence class is available in a Java EE container environment as
>> well; however, support for the Java SE bootstrapping APIs is not required
>> in container environments.
>>
>> so it is supposed to work in java EE also.
>>
> Well, who said it is not supposed to work. If you read the spec entirely,
> you will see the created EMF behaves differently than the injected one.
>
> Sahoo