Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-664

Support declaration of an EntityManager resource through a passivating-scoped producer method

XMLWordPrintable

      If an EntityManager resource is made available through a Producer method and the method is annotated with a passivating scope as shown below, Weld today fails
      with this error message: " WELD-000053 Producers cannot declare passivating scope and return a non-serializable class"

      — producer method snippet —
      @PersistenceUnit(unitName = "UDEMpu")
      private EntityManagerFactory emf;

      @Produces
      @ConversationScoped
      @UserDatabase
      public EntityManager create()

      { return emf.createEntityManager(); }

      — producer method snippet —
      The current workaround is to not use a "passivating scoped" producer method and fall back to annotating the "passivating scoped" producer field with @PersistenceContext.

      Pete's idea is to enhance the user experience for a user who expects this to work by proxying the EMF and ensuring that the createEntityManager returns a proxy that is Serializable.

              Unassigned Unassigned
              sivakumart_jira Sivakumar Thyagarajan (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: