2 Replies Latest reply on Mar 14, 2006 1:27 PM by da.ogre

    Database empty after JBoss restart

    marc-1

      Hello,
      i'm developing a small web application to test out how jboss works.

      I'm using a MySQL 5.0 database.

      Everything works fine. The data are in the database (MySQL Admin shows XX rows, ect.) and i retrive the data correct when i'm using EQL Statements.

      But always when i stop jboss and restart it, the database is complete empty.

      My persistence.xml looks like that:

      <entity-manager>
       <name>bnwdb</name>
       <jta-data-source>java:/bnwDS</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       </properties>
      </entity-manager>



      So what could be the problem?

        • 1. Re: Database empty after JBoss restart
          pdog4x4

          Are you using hand coding your jboss-ejbcmp.xml, XDoclet or EJB3?

          If you are using XDoclet, try adding @jboss.persistence remote-table = "false" as demonstrated below.

          /**
           * @jboss.persistence remove-table = "false"
           */
          public abstract class TestBean implements EntityBean {
           ...
          }
          


          Hope that helps!

          Joshua Preston.

          • 2. Re: Database empty after JBoss restart
            da.ogre

            Hi!
            Change the value create-drop to update. Create-drop means that the DDLs will be created from the mapping files, and will create the corresponding tables in the database, and will be dropped when the beans are undeployed.
            So your fixed property will be:

            <property name="hibernate.hbm2ddl.auto" value="update"/>


            Happy coding! :)