-
1. Re: How to find a container managed entity manager through J
fhh Apr 7, 2007 9:22 AM (in response to pxpwxj)Resource injection with annotations is only supported in 2.5 servlet containers. It will not work with JBoss 4.0.x. Use a JNDI-lookup instead.
Regards
Felix -
2. Re: How to find a container managed entity manager through J
pxpwxj Apr 7, 2007 9:28 AM (in response to pxpwxj)tks.
in my persistent.xml,i named the persistent unit "synch".When i attempt to get it through jndi,my code is like this:...context.lookup("synch");or context.lookup("java:/synch"),and the program error msg is:name sych is not bound.and i can not find the unit name under jboss's jndiview(in it's console interface).
I guess i should get it through jndi,but i just do not know how to work out!
respect!!! -
3. Re: How to find a container managed entity manager through J
fhh Apr 7, 2007 2:08 PM (in response to pxpwxj)Look at the Seam documentation to see how an EntityManagerFactory (!) can be bound to JNDI.
BTW: When writing a servlet remember that the EntityManager is not thread safe. Obtain one from the Factory for every invocation of the servlet.
Regards
Felix -
4. Re: How to find a container managed entity manager through J
pxpwxj Apr 8, 2007 6:14 AM (in response to pxpwxj)tks!
i will remember your remind of to pay attention to thread safe.It is like the hibernate session from this aspect?
But does a entitymanager hold too many resource,and i make one for each thread,the performance will be reduced? -
5. Re: How to find a container managed entity manager through J
fhh Apr 8, 2007 6:42 AM (in response to pxpwxj)
i will remember your remind of to pay attention to thread safe.It is like the hibernate session from this aspect?
I don't know Hibernate very well but I guess it is.
But does a entitymanager hold too many resource,and i make one for each thread,the performance will be reduced?
Use entityManager.close().
Regards
Felix -
6. Re: How to find a container managed entity manager through J
pxpwxj Apr 8, 2007 6:57 AM (in response to pxpwxj)
oh,my god.Seam is such a big and complex system.
How can i know its mechanism to bind a EntityManagerFactory to jndi.
any clue? -
7. Re: How to find a container managed entity manager through J
pxpwxj Apr 8, 2007 6:59 AM (in response to pxpwxj)tks,for all your help.
really! -
8. Re: How to find a container managed entity manager through J
pxpwxj Apr 8, 2007 8:15 AM (in response to pxpwxj)may i get the clue.
i got some posts which have the same problem.
i will try follow those.
tks -
9. Re: How to find a container managed entity manager through J
fhh Apr 8, 2007 3:24 PM (in response to pxpwxj)From the Seam docs (ch. 8.3.1):
Of course, you need to make sure that you have bound the EntityManagerFactory into JNDI. In JBoss, you can do this by adding the following property setting to persistence.xml.<property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/bookingData"/>
Regards
Felix