Convert Pojo Components to EJB3
I tried to use an extended PersistenceContext
in a component by adding
@Pe开发者_StackOverflow中文版rsistenceContext(type=PersistenceContextType.EXTENDED)
EntityManager entityManager;
In order to use this Seam forces me to delcare the component as a Stateful Session Bean (SFSB). To meet the requirements I have to create an interface for SFSB's methods even the methods declared in EntityHome<E>
and Home<E>
is this the right (Seam) way?
From a Seam point-of-view, it's OK using the extended PersistenceContext
. You can also read these two references for pros and cons of using it: When do I use @In vs @PersistenceContext to inject an EntityManager? and
EntityManager injection: @PersistenceContext or @In ??.
Since Home<E>
is conversation scoped, I would try to benefit from that scope to get an extended persistence context. Although, using an extended PersistenceContext
is fine, the conversation scope this is definitely more the 'Seam-way'. However, since I'm not aware of what you want to accomplish, the conversation-scope might not be approperiate...
精彩评论