2 Replies Latest reply on Aug 2, 2018 7:12 AM by Matej Novotny

    Weld SPI: ResourceReference vs. ResourceReferenceFactory

    Laird Nelson Apprentice

      I'm implementing JPAInjectionServices.

       

      When working with EntityManager references, should I:

       

       

      …?

       

      In other words, should the ResourceReference#getInstance() method implementation be a factory, returning a new EntityManager instance every time it is invoked, or should it be a "holder", returning a single instance every time it is invoked?

       

      The javadocs for ResourceReference#getInstance() and ResourceReferenceFactory#createResource() do not help here.

       

      Best,

      Laird