1 Reply Latest reply on Nov 23, 2016 9:34 AM by Cheng Fang

    JBeret, SE, EntityManager

    Remo Meier Newbie

      Hi

       

      I'm setting up JBeret with Deltaspike to get batch unit testing. The setup is quite similar to the JBeret SE implementation with Weld. A TransactionManager is provided by Deltaspike (more or less, currently I do some manual tweaks).

       

      In general everything works fine. But I wonder what is the correct scope for the EntityManager? @PersistenceContext ist not available in this setup. So I have to produce and inject an entity manager manually. What would be the proper scope of this entity manager?

      @ReqestScoped, Thread-local, @TransactionScoped or one of the JBeret Scopes like JobScoped?

       

      If there is any interest, this testing setup might also be a worthwhile contribution (either for jberet or deltaspike).

       

      Thx Remo

        • 1. Re: JBeret, SE, EntityManager
          Cheng Fang Master

          I'm not familiar with Deltaspike.  My feeling is the entity manager should be scoped to a step, since other steps in the same job may use other resources.  For a partitioned step execution, I think the same entity manager can still be safely used by multiple partitions of the same step concurrently, though I haven't tried that. 

           

          Thanks for your interest.  Here at JBeret we always welcome and value developer and user contribution.  We could potentially house that somewhere under GitHub - jberet/jsr352: Implementation of JSR 352  as an extra module.  Let us know when it's ready for a review.