Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5549

Add support for @PersistenceContexts and @PersistenceUnits

XMLWordPrintable

      See example here of using @PersistenceContexts.

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

              smarlow1@redhat.com Scott Marlow
              smarlow1@redhat.com Scott Marlow
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: