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: Werner Keil <werner.keil_at_gmail.com>
Date: Tue, 18 Sep 2012 11:57:46 +0200

I thought, that's done as of today with

@PersistenceContext(unitName="...")

Or is this a Spring proprietary way?[?] (found it on a SpringSource docu)


Would each PersistenceContext need more than one PersistenceUnit? Otherwise
even if this has so far been Spring-specific, maybe we could keep that an
attribute of the PersistenceContext instead of yet an other array of
annotations??

Werner

On Tue, Sep 18, 2012 at 11:52 AM, Scott Marlow <smarlow_at_redhat.com> wrote:

> Could we also describe the @PersistenceUnits.
>
> "
> @PersistenceUnits
>
> If you need to specify more than one @PersistenceUnit, specify all the
> persistence units using a single @PersistenceUnits annotation.
> "
>
> Scott
>
>
> On 09/13/2012 07:29 PM, Linda DeMichiel wrote:
>
>> 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<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");
>>>>> ...
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>




347.gif
(image/gif attachment: 347.gif)