0 Replies Latest reply: Oct 28, 2011 5:52 AM by nick humphrey RSS

    how do the jboss 7 quickstarts examples automatically populate the H2 db?

    nick humphrey Newbie

      i'm reading the in-depth tutorial for the kitchensink project:

      https://docs.jboss.org/author/display/AS7/The+kitchensink+example+in+depth

       

      and it says "import.sql which Hibernate, the JPA provider in JBoss AS 7, will use to load the initial users into the application when the application starts"

       

      where/how do they do this? where's the "load on startup" functionality?

       

      ok according to this page:

      http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html

       

      this line in persistence.xml:

      <property name="hibernate.hbm2ddl.auto" value="create-drop" />
      

       

      is what tells the app to populate the database, but where's the connection to the import.sql file?

       

      after reading this page:

      http://seamframework.org/Community/ImportsqlAndHibernatehbm2ddlautoDoesntWork

       

      users reported that this is an under-documented feature, that when a file called import.sql is found in the root classpath, i.e. here:

      jboss-as-web-7.0.2.Final/standalone/deployments/jboss-as-kitchensink.war/WEB-INF/classes/import.sql

       

      it will get automatically run, based on the above line in persistence.xml. so my question is where is this officially documented?

       

      http://docs.jboss.com/books/lightweight/ch03.html#fig3.2