This content has been marked as final.
Show 1 reply
-
1. Re: EntityManager - How to get it on a class that is not a SeamComponent
accless Jan 23, 2009 12:12 AM (in response to mpssantos.mpssantos.gmail.com)So far, i can imagine of three ways:
1) EJB
@PersistenceContext private EntityManager entityManager;
No Seam needed for this injection, as the ejb-container will do it for you
2) SMPC
@In private EntityManager entityManager;
Seam is needed, as you are injecting the seam managed persistence context.
3) SMPC
EntityManager em = (EntityManager)Component.getInstance("entityManager");
Same as before. But in comparison you do not rely on a seam interceptor for the injection.
Very useful for components having the @ByPassInterceptorHope this helps you a bit...
Greetings