1 Reply Latest reply on Aug 18, 2006 4:54 AM by pmpm

    How to run code on deployment?

    mwoelke

      Hi,
      Can anyone tell me how to run code or scripts at deployment time. For example to set up defaults in the db.

      Thanx in advance.
      Milan Wölke

        • 1. Re: How to run code on deployment?
          pmpm

          AFAIK there is no standard way do this.
          My solution on JBoss looks like this:

          @Service
          @Depends( {
          //things i need before my startup code executes "jboss.j2ee:ear=baks-erp.ear,jar=baks-erp-ejb3.jar,name=TheBeanINeedInStartupCodeEJB,service=EJB3",
           })
          public class StartupClass implements StartupClassManagement
          {
           public void start() throws Exception
           {
           //code to be executed on startup
           }
          }
          


          @Management
          public interface StartupClassManagement
          {
           public void start() throws Exception;
          }