You could write an mbean to do that. In order to avoid problems with "who starts first" you may want to have your mbean programatically deploy your application, then create the entity beans. In 3.0 (cvs) I believe you can get the same effect by packing your ejb-jar inside a sar.
Thanks for your advice. Do you know any tutorial or
example on how to do that ?
in case of... just another idea :
I already got this kinf of need, I resolved it by calling a singleton class instance within the Create method of my EJB, so every time this EJB is instanciated by the container it referes to this singleton that performs tasks at initialization time of the ejb, you can implement other tasks in the postCreate method of your EJB as well.
the singleton is usefull to insure not having multiple instances of a utility class jut needed once.
your singelton class can perform any file load through a call to the ContextClassLoader, etc etc
it was just an idea
Thanks for the suggestion. My understanding is, to be able to invoke the Create method of your EJB, you still need a invoker (client) which is outside the JVM of the application server. I need a way to invoke a bean method directly from application server's JVM after the bean is deployed. Is there any simple way to do it ? Seems this should be a common problem to deal with.
absolutely, you need a first call by a client within the same jvm or not.
but I can't figure why a server should need data if there's no client needing them...
at the very first call you can load data needed, just once in a cache, as I mentioned in my earlier message.