0 Replies Latest reply on Mar 16, 2010 5:46 PM by Rafael Meneses

    Execute code at startup.

    Rafael Meneses Newbie

      Hello,

       

      I have a .ear apps. I want to execute a database import before hibernate loading, must be before hibernate make the mapping.


      I tried a mbean with dependency on the datasource ("jboss.jca:name=pmgSaipDatasource,service=DataSourceBinding"), I tried, using seam, with this method:

       

      @Name("arranque2")
      @Scope(ScopeType.APPLICATION)
      @Startup
      public class Arranque2 {

       

          @Create
          public void pega(){
              System.out.println("HACIENDO EL IMPORT");
          }
         
      }

       

      The same problem. Hibernate execute first, the database is without tables ==> hibernata fail ==> import database failed.

       

      I use JBoss 4.2.3

       

       

      have someone an idea?

       

       

      Cheers,