persistence@glassfish.java.net

Re: persistence.xml in Java SE environment

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Fri, 10 Feb 2006 08:30:21 +0530

Dibyendu,

Dibyendu Majumdar wrote:

> I am trying out a scenario where I have a persistence.xml file with
> two units defined, one
> JTA and the other local. When I run this under J2SE I get an exception.

If you are not attempting to use that JTA PersistenceUnit, I don't
understand why you should be getting any exception on Java SE? After all
your application controls what persistence unit to be loaded. Provider
must not load all the persistence units defined in a persistence.xml
automatically. So file a bug. It appears to be an implementation issue.

Thanks,
Sahoo

> Removing
> the JTA unit appears to resolve the problem.
>
> Please see
> http://forums.java.net/jive/thread.jspa?threadID=12878&tstart=15 for
> more details.
>
> From a user perspective, a key selling point of EJB 3.0 Persistence is
> that it is
> meant to work both inside and outside the container. I would certainly
> like to
> see that the implementation works as seamlessly as possible across all
> environments.
>
> Regards
>
> Dibyendu
>
> Mike Keith wrote:
>
>> Right. Using JTA in an SE environment is value add that can be
>> supported and that we in fact intend to continue to support. It is
>> beyond the spec, but not disallowed.
>>
>>
>>
>>> -----Original Message-----
>>> From: Tom Ware [mailto:tom.ware_at_oracle.com]
>>> Sent: Thursday, February 09, 2006 10:58 AM
>>> To: persistence_at_glassfish.dev.java.net
>>> Cc: Mike Keith; Linda DeMichiel
>>> Subject: Re: persistence.xml in Java SE environment
>>>
>>>
>>> As I understand things, there is nothing in the specification that says
>>> providers cannot support JTA outside a container. In fact, in our
>>> original EJB 3.0 preview, we provided a test container that provided a
>>> very basic JTA implementation so people could test their application
>>> without actually being in a container. Although this test container
>>> has
>>> not been kept up to date, I would not be surprised if eventually
>>> customers wanted this kind of functionality.
>>>
>>> -Tom
>>>
>>> Marina Vatkina wrote:
>>>
>>>
>>>
>>>> Tom, Michael,
>>>>
>>>> Shouldn't this element be ignored in Java SE (along with
>>>
>>> ...-datasourse
>>>
>>>
>>>> ones) if the provider uses properties for the resource
>>>
>>> settings? There
>>>
>>>
>>>> is no value in specifying RESOURCE_LOCAL in this case.
>>>>
>>>> Mike, Linda, what do you think?
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>> Tom Ware wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> Michael and Marina,
>>>>>
>>>>> Michael is right. Java SE examples should be updated to use
>>>>> RESOURCE_LOCAL.
>>>>>
>>>>> -Tom
>>>>>
>>>>> Michael Bouschen wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Marina,
>>>>>>
>>>>>> the <persistence-unit> element in the persistence.xml file has an
>>>>>> attribute transaction-type which defaults to JTA. I think
>>>>>
>>> this default
>>>
>>>
>>>>>> is not useful in a Java SE environment, so the persistence.xml file
>>>>>> should explicitly set the attribute to RESOURCE_LOCAL in this case.
>>>>>>
>>>>>> We should update the persistence.xml in the Java SE
>>>>>
>>> available on the
>>>
>>>
>>>>>> glassfish "Persistence Example" page. What do you think?
>>>>>>
>>>>>> Regards Michael
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>> --
>>> Tom Ware
>>> Principal Software Engineer
>>> Oracle Canada Inc.
>>>
>>> Direct: (613) 783-4598
>>> Email: tom.ware_at_oracle.com
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>