users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: changes for 7.6.2 Container-managed Transaction-scoped Persistence Context

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Tue, 29 Nov 2011 15:48:53 -0800

On 11/29/2011 12:15 PM, Scott Marlow wrote:
> On 11/29/2011 02:19 PM, Linda DeMichiel wrote:
>>
>>
>> On 11/29/2011 11:06 AM, Scott Marlow wrote:
>>> Hi Linda,
>>>
>>>>
>>>> Perhaps I am failing to grasp your concern here, but I see the intention
>>>> of the last
>>>> paragraph of section 7.6.2 as specifying the user-visible behavior that
>>>> is required
>>>> to result. Your paragraph above describes a possible implementation
>>>> strategy to
>>>> achieve it, but I don't think the spec needs to include that.
>>>>
>>>
>>>
>>> I think that the current 7.6.2 wording "detached at the end of the
>>> method call", is ambiguous about which method call is
>>> intended (the entity manager method invocation or the container level
>>> method invocation.)
>>>
>>> I think that clarifying it with one of the following changes, would
>>> eliminate the ambiguity.
>>>
>>> Updated proposal for last paragraph in 7.6.2:
>>>
>>> "
>>> If the entity manager is invoked outside the scope of a transaction,
>>> any entities loaded from the database will
>>> immediately become detached at the end of the container level method
>>> invocation call.
>>> "
>>
>> Just to be very clear.... What are you referring to by "container level
>> method
>> invocation call"? The call to the entity manager proxy?
>
> Not the call to the entity manager proxy. I mean the code that is calling the entity manager proxy (e.g. a session bean
> calling the entity manager proxy.)
>
> Perhaps a clearer proposal could be:
>
> "
> If the entity manager is invoked outside the scope of a transaction, any entities loaded from the database will
> immediately become detached at the end of the container level method invocation call (e.g. when the session bean method
> ends).
> "

Ah, thanks. That is not the intended semantics. Rather it is that the
persistence context is created to service the method call that is made
on the entity manager only. It doesn't have the duration of a business
method invocation.

>
>>
>> thanks,
>>
>> -Linda
>>
>>
>>>
>>> Regards,
>>> Scott
>