This content has been marked as final.
Show 3 replies
-
1. Re: @Startup and hbm2ddl
vanyatka Dec 13, 2007 9:39 AM (in response to vanyatka)Can anyone confirm/deny that entityManager cannot be used in @Startup components while hbm2ddl is being used?
-
2. Re: @Startup and hbm2ddl
matt.drees Dec 13, 2007 1:34 PM (in response to vanyatka)If you're using an EntityManagerFactory component (i.e., you're not using the app server's EMF), then the hbm2ddl is run by entityManagerFactory's @Create method. So your @Startup component depends on the database, then you can denote the dependency in the annotation:
@Startup(depends={"yourEntityManagerFactoryNameHere"})
and your component's @Create method will be run afterwards.
However, instead of using an application-scope/@Startup component, I'd recommend using an observer of the org.jboss.seam.postInitialization event. It's a bit cleaner, IMO. -
3. Re: @Startup and hbm2ddl
vanyatka Dec 13, 2007 2:10 PM (in response to vanyatka)Thanks, matt!
Your suggestion with "depend" annotation totally worked. And, also, it helped me with another issue I was having:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112686#4112686
I'll definitely give the observer a try, never used any observers before.