Try injecting the entityManager:
@In("entityManager") private EntityManager em;
It works for me in an application scoped component for initializing purposes, like you need. I'd like to know the difference of injecting it or using the @PersistentContext annotation...
Hope it helps!
afaik @PersistentContext can be used only with session beans and message driven beans
You can use @PersistenceContext (if you make it a @Stateful bean) or @In EntityManager entityManager; if you have an SMPC configured in components.xml
That works, thanks
One limitation in here, I can query the properly however I cannot save entities the
seems to do nothing, even at the sql logging level I can see all the selects but not inserts.
I had to convert the startup POJO into a stateful bean, use the persistence context and now it works like charm.
Thanks again Pete ;-)
I don't need to convert to a Stateful Bean, my POJO can persist entities, i think the difference is that my startup method is annotated @Transactional.