jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: unsynchronized application-managed PCs

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Tue, 06 Dec 2011 14:24:14 -0800

Hi Rainer, all,

On 12/6/2011 5:08 AM, Rainer Kwesi Schweigkoffer wrote:
> Hi Linda, all,
>
> for the EDR I'd define a property and wait for comments.
>
> To my understanding an AMPC with a JTA EM created outside a JTA
> transaction defaults to unsynchronised, an AMPC with JTA EM created
> inside a JTA transaction and an AMPC with an RL EM to synchronised.
>

Hmmmm.... Please see section 7.9.2.

When a JTA application-managed persistence context is created inside
the scope of a transaction, it is synchronized with regard to that
transaction.

However, after that transaction ends, it is not synchronized with a
subsequent transaction unless joinTransaction is invoked. Because
this is an application-managed PC, this is an application's
responsibility rather than a requirement on the container. So, we
can't default it to have the behavior of SynchronizationType.SYNCHRONIZED
and maintain backward compatibility.

When a JTA application-managed persistence context is created outside the
scope of a transaction, it is not synchronized with regard to the next tx,
and is not otherwise synchronized with regard to subsequent transactions,
so in that case we could claim that an application-managed persistence
context created outside the scope of a transaction defaults to
SynchronizationType.UNSYNCHRONIZED.

That said, if we do extend the notion of SynchronizationType to JTA
application-managed PCs, it seems clearest to me to define that there
is no default.

best regards,

-Linda

> Best regards
> Rainer
>
> Am 5 Dec 2011 um 15:40 hat Linda DeMichiel geschrieben:
>
>> It looks like the consensus is that we should add the ability to
>> allow application-managed persistence contexts to be specified as
>> unsynchronized.
>>
>> The next issue, of course, is to agree on the API for this.
>>
>> Does this warrant adding to EntityManagerFactory a createEntityManager method
>> that takes a SynchronizationType argument? Or just provide this via a
>> property that is passed in the Map argument to createEntityManager?
>>
>
> ---
> Rainer Schweigkoffer SAP AG Walldorf
> Business Solution& Technology TD Core JI
> Technology Development Dietmar-Hopp-Allee 16
> Java Server Core D-69190 Walldorf
> JEE Implementation Group phone: +49 6227 7 45305
> Building 3, I.3.14 fax: +49 6227 7 821177
> rainer.schweigkoffer_at_sap.com
>
> Sitz der Gesellschaft/Registered Office: Walldorf, Germany
> Vorstand/SAP Executive Board: Werner Brandt, Bill McDermott (Co-CEO),
>
> Gerhard Oswald, Vishal Sikka, Jim Hagemann Snabe (Co-CEO)
> Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory
> Board: Hasso Plattner
> Registergericht/Commercial Register Mannheim No HRB 350269
>
> Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige
> vertrauliche Informationen enthalten. Sollten Sie diese E-Mail
> irrtuemlich erhalten haben, ist Ihnen eine Verwertung des Inhalts,
> eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich
> untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die
> empfangene E-Mail. Vielen Dank.
>
> This e-mail may contain trade secrets or privileged, undisclosed, or
> otherwise confidential information. If you have received this e-mail
> in
> error, you are hereby notified that any review, copying, or
> distribution
> of it is strictly prohibited. Please inform us immediately and
> destroy the
> original transmittal. Thank you for your cooperation.
>
>
>