jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: add description of _at_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:03:33 -0700

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");
> ...
> }
> }
>
>
>