This content has been marked as final.
Show 5 replies
-
1. Re: EntitiManager and Observer("org.jboss.seam.postInitialization")
marx3 Feb 29, 2008 8:34 AM (in response to marx3)Accordingly to this
link
injecting EntityManager should work, but it doesn't.
Any help? -
3. Re: EntitiManager and Observer("org.jboss.seam.postInitialization")
kyatim Jun 14, 2010 7:53 AM (in response to marx3)Don't forget put @Name annotation
(it was may problem but now all work fine) -
4. Re: EntitiManager and Observer("org.jboss.seam.postInitialization")
zaquas Apr 27, 2011 2:32 PM (in response to marx3)It appears not work with jboss as 6.0 final.
I've try with this code:
@Name(value="applicationstartup") public class ApplicationStartup { @In EntityManager entityManager; @Observer(value="org.jboss.seam.postInitialization") public void startup(){ // my business code stay here... } }
But I've only read in the console:
Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/poplaEntityManagerFactory
Have you some ideas?
Thanks in advance
Stefano -
5. Re: EntitiManager and Observer("org.jboss.seam.postInitialization")
zaquas Apr 28, 2011 6:08 AM (in response to marx3)Hello,
I've investigated all this morning and I found that the same code work well with jboss as 5.1.After that, I tried as suggest Pete in this post as here:
@Name(value = "applicationstartup") @Transactional public class ApplicationStartup { @In AsynchronousProcessor asynchronousProcessor; @Observer(value = "org.jboss.seam.postInitialization") public void startup() { System.out.println("wating for..."); asynchronousProcessor.runAction(30 * 1000l); } }
@Name("asynchronousProcessor") @AutoCreate public class AsynchronousProcessor { @In EntityManager entityManager; @Asynchronous public void runAction(@Duration long duration) { System.out.println(entityManager.toString()); } }
And in this manner works! But, for some strange thing, if I put time at few millisecond, not work again...
Strange things!!!