users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: locks and fetch graphs / eager fetching

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Wed, 10 Jul 2013 14:02:27 -0700

On 7/10/2013 1:57 PM, Ireland, Evan wrote:
> Linda,
>
> In the javadocs, we see:
>
> "... element collections and relationships owned by the entity that are contained in join tables will be locked ..."
>
> Did we specify what it means to lock an element collection or relationship, if other than locking the individual entity instances that those collections/relationships refer to?
>

The target entities aren't locked, but rather the join table data (i.e., for many-many relationships and
unidirectional one-to-ones).


> Or do some folks interpret this locking to include anti-insert, anti-delete locking?
>
> -----Original Message-----
> From: Linda DeMichiel [mailto:linda.demichiel_at_oracle.com]
> Sent: Thursday, 11 July 2013 7:50 a.m.
> To: jsr338-experts_at_jpa-spec.java.net
> Subject: [jsr338-experts] Re: locks and fetch graphs / eager fetching
>
> Hi Christian,
>
> On 7/10/2013 12:55 AM, Christian von Kutzleben wrote:
>> Dear group,
>>
>> In our understanding EntityManager.lock() only applies the lock to the specified entity and
>> also during lazy loading triggered by object navigation locks won't get propagated.
>>
>
> Yes. However, the javax.persistence.lock.scope property may be used to extend the locking
> to element collections and owned relationships in join tables.
>
>> But if a user specifies a lock-mode in the find or refresh method or for a query,
>> is this lock-mode supposed to be applied to all objects fetched* along because
>> of FetchType.EAGER or a configured fetch graph as well?
>>
>> *fetched, or would be fetched if not already in context
>>
>
> No (however, again the lock.scope property may be applied to the entity that is the target
> of the operation).
>
> regards,
>
> -Linda
>
>
>> Thank you!
>>
>> Christian
>>
>> --
>>
>> *Christian von Kutzleben*
>> Chief Software Engineer
>> Versant GmbH, Subsidiary of Actian Corporation
>> christian.vonkutzleben_at_actian.com<mailto:christian.vonkutzleben_at_actian.com>
>>
>> PHONE +49 40 60990-273
>> FAX +49 40 60990-113
>> www.actian.com<http://www.actian.com/>
>>
>> Versant GmbH is incorporated in Germany. Company registration number: HRB 54723, Amtsgericht Hamburg. Registered Office:
>> Halenreie 42, 22359 Hamburg, Germany. Geschäftsührer: Marc Monahan, Fred Gallagher, Volker John
>>
>> Facebook-icon<http://www.facebook.com/actiancorp>Twitter-icon<http://twitter.com/actiancorp>Linked-In-icon
>> <http://www.linkedin.com/company/actian-corporation>You-Tube-icon
>> <http://www.youtube.com/actiancorporation>http://davidwalsh.name/dw-content/googleplus-icon.png
>> <http://www.gplus.to/actiancorp>
>>
>> *cid:image001.jpg@01CC7916.C4DCFC40<http://www.actian.com/>*
>>
>> This transmission is confidential and intended solely for the use of the recipient named above. It may contain
>> confidential, proprietary, or legally privileged information. If you are not the intended recipient, you are hereby
>> notified that any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this
>> transmission in error, please contact the sender by reply e-mail and delete the original transmission and all copies
>> from your system.
>>