The EJBs are responsable for business processes/logic (i.e: methods), and are able to orchestrating others CDI controllers, is not so common let the EJB create objects, for that you would prefer a CDI POJO Producer.
In your case is leaner to use a CDI object and produce the object that you need from there, looks like a DAO and could be used (i mean, injected) into the EJB.
Think of EJBs on terms of a Boundary Pattern, using specialized controllers.
Notes:
- @Stateless is not required to implements Serializable, these are pooled, and its lifecycle does not allow serialization.
- In general you dont want to use a getter to the entity manager of an EJB, you should prefer write a method and use the
em
internally. - The persistence context is easier to manipulate if uses JTA
- Your @Stateless should begins the transactions and let them propagated along the controllers
- The
em
with package visibility is a good idea, lets you mock your facade / boundary easily