jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: [jpa-spec users] Re: add description of @PersistenceContexts to section 10.4.1 of the JPA 2.1 spec...

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Thu, 13 Sep 2012 10:29:31 -0700

Well, if people are confused, it doesn't hurt. Perhaps the javadoc page would be a better place though.

On 9/13/2012 10:22 AM, michael keith wrote:
> Adding examples for @PersistenceContexts would kind of stick out, wouldn't it? If we add for that one annotation then we
> should probably add examples for all of them in the chapter. There are currently no examples for any of them.
>
> Sections 10.3.1 and 10.3.2 don't do any more than just mention the plural form in a sentence that states which classes
> they can annotate, and then they include the pluralized annotation definition. Sections 10.3.3 and 10.4.1 did include
> the definition, but did not mention it in text. Seems like if we wanted to make 10.3.3 and 10.4.1 be consistent with
> 10.3.1 and 10.3.2 the only thing that would need to be added would be a general statement of the form used in 10.3.1 and
> 10.3.2:
>
> <Annotation> and <pluralizedAnnotation> can be applied to .....
>
> -Mike
>
> On 13/09/2012 1:03 PM, Linda DeMichiel wrote:
>> Hi Scott,
>>
>> Thanks for the suggestion. I will add.
>>
>> -Linda
>>
>>
>> On 9/13/2012 5:37 AM, Scott Marlow wrote:
>>> Hi eg,
>>>
>>> I don't see a description of @PersistenceContexts. Could we add a few words about @PersistenceContexts to section
>>> 10.4.1?
>>>
>>> http://www.oracle.com/technetwork/middleware/ias/toplink-jpa-annotations-096251.html includes the following:
>>>
>>> "
>>> @PersistenceContexts
>>>
>>> If you need to specify more than one @PersistenceContext, you must specify all your persistence contexts using a single
>>> @PersistenceContexts annotation.
>>> "
>>>
>>> The above link also has an example that would be nice to include:
>>>
>>> @Stateless
>>> @PersistenceContexts({
>>> @PersistenceContext(name="OrderEM"),
>>> @PersistenceContext(name="ItemEM")
>>> })
>>> public class OrderEntryBean implements OrderEntry {
>>> @Resource EJBContext ctx;
>>> public Customer getCustomer(int custID) {
>>> EntityManager em = (EntityManager)ctx.lookup("OrderEM");
>>> return em.find(Customer.class, custID);
>>> }
>>> public void enterItem(int orderID, Item newItem) {
>>> EntityManager em = (EntityManager)ctx.lookup("ItemEM");
>>> ...
>>> }
>>> }
>>>
>>>
>>>
>>