This content has been marked as final.
Show 5 replies
-
1. Re: Spring and EJB3 EntityManager
alesj Jun 6, 2006 5:02 PM (in response to jaboj)This is what first comes to my mind:
@Stateless public class myBean implements myBeanLocal { @PersistenceContext(unitName = "MM") private EntityManager em; @Spring(jndiName = "mm", bean="myDao") private MyDao myDao; @AroundInvoke public Object injectEM2DAO(InvocationContext c) { myDAO.setEM(em); return c.proceed(); } public void createSome() { myDao.save(someObject); } }
-
2. Re: Spring and EJB3 EntityManager
jaboj Jun 7, 2006 3:19 AM (in response to jaboj)Thank you. This is one way of doing it. But I hope to find a solution where the EntityManager setting in the dao is handled totally in spring. Then it only would be neccesary to inject the dao into the session beans.
I'm thinking on a spring context like this:<bean id="myDao" class="somePackage.myDao"> <property name="entityManager" ref="entityManager"/> </bean> <bean id="entityManagerFactory" class="someEntityManagerClass"> ..... </bean>
Has anyone tried to wire up the EntityManager in spring? -
3. Re: Spring and EJB3 EntityManager
vitarara Aug 22, 2006 9:39 PM (in response to jaboj)So, has anyone gotten this working?
I tried adding:
type entries to my persistance.xml file, but the EntityManager and the factory are not being exposed via jndi.
Thanks,
Mark -
4. Re: Spring and EJB3 EntityManager
vitarara Aug 22, 2006 9:41 PM (in response to jaboj)My appologies for the double post. I forgot the code tags.
So, has anyone gotten this working?
I tried adding:<property name="jboss.entity.manager.jndi.name" value="java:/Manager1"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/Manager1Factory"/>
type entries to my persistance.xml file, but the EntityManager and the factory are not being exposed via jndi.
Thanks,
Mark -
5. Re: Spring and EJB3 EntityManager
alesj Aug 25, 2006 11:10 PM (in response to jaboj)What's the real problem here? Ok, all Spring stuff is by default exposed by jboss later than ejb3, but that is plain config stuff.