[jboss-user] [JBoss Seam] - Re: ResourceBundle in Database
Zerg-Spirit
do-not-reply at jboss.com
Tue Jul 3 06:42:19 EDT 2007
Thanks, it helped me a lot!
Now, I kinda understood how it's working, but my very last problem is pretty tough: I can't retrieve the EntityManager in my Session Bean extending ResourceBundle.
@Stateless
| @Scope(SESSION)
| @Name("dbResourceBundle")
| public class DBResourceBundle extends ResourceBundle implements iDBResourceBundle{
|
| @PersistenceContext
| private EntityManager em;
|
| private List<CustomResourceBundle> availableResourceBundles;
|
| public DBResourceBundle(){
| System.out.println("EntityManager: "+em); //em is null :/
| try{
| availableResourceBundles = em.createQuery("select rb from CustomResourceBundle rb").getResultList();
| }
| catch(Exception e){
| //null pointer exception cause em is null.
| e.printStackTrace();
|
| }
| }
| ...
|
CustomResourceBundle being an entity bean representing a 'bundle' for the given language.
How to retrieve a workable EntityManager?
My guess is that when this Session Bean is instanciated, the PersistenceContext isn't created yet.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059868#4059868
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059868
More information about the jboss-user
mailing list