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

    Weld SPI: ResourceReference vs. ResourceReferenceFactory

    ljnelson

      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