users@glassfish.java.net

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

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Mon, 13 Dec 2010 10:19:04 +0530

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