6 Replies Latest reply on Oct 19, 2005 1:04 PM by Stephane PAQUET

    database flushed on each deploy

    Pieter-Jan Malfait Newbie

      everytime i redeploy my EJB3 application to JBoss all the data in my database gets flushed, how can i prevent this ?

        • 1. Re: database flushed on each deploy
          Bill Burke Master

          comment out:

          ejb3.deployer/META-INF/persistence.properties

          hbm2ddl=create-drop

          or change it to update.

          • 2. Re: database flushed on each deploy
            Pieter-Jan Malfait Newbie

            it seems it is already commented out, is there another place where i can config the hbm2ddl properties ?

            this is my persistence.properties :

            hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTrans
            hibernate.connection.release_mode=after_statement
            hibernate.transaction.flush_before_completion=false
            hibernate.transaction.auto_close_session=false
            hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
            #hibernate.hbm2ddl.auto=create-drop
            hibernate.hbm2ddl.auto=update
            hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
            # Clustered cache with TreeCache
            #hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook
            #hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache
            hibernate.connection.datasource=java:/DefaultDS
            hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
            hibernate.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFact
            hibernate.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

            • 3. Re: database flushed on each deploy
              Pieter-Jan Malfait Newbie

              i can find no other place to configure it

              #.../jboss-4.0.3RC2$ fgrep -rin --exclude *log* hbm2ddl *
              Binary file server/all/deploy/jboss-hibernate.deployer/hibernate3.jar matches
              server/all/deploy/ejb3.deployer/META-INF/persistence.properties:6:#hibernate.hbm2ddl.auto=create-drop
              server/all/deploy/ejb3.deployer/META-INF/persistence.properties:7:hibernate.hbm2ddl.auto=update
              Binary file server/all/deploy/ejb3.deployer/hibernate3.jar matches
              Binary file server/all/tmp/deploy/tmp34886hibernate3.jar matches
              Binary file server/all/tmp/deploy/tmp34904hibernate3.jar matches
              Binary file server/default/deploy/jboss-hibernate.deployer/hibernate3.jar matches

              • 4. Re: database flushed on each deploy
                J-C jc Apprentice

                For my app i put it in the persistence.xml of the par.

                <?xml version="1.0" encoding="UTF-8"?>
                <entity-manager>
                 <name>toto</name>
                 <jta-data-source>java:/MySqlDS</jta-data-source>
                 <properties>
                 <property name="hibernate.hbm2ddl.auto" value="update"/>
                 <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                 </properties>
                </entity-manager>


                • 5. Re: database flushed on each deploy
                  Pieter-Jan Malfait Newbie

                  it seems the JBoss server updates the tables now rather than re-creating them :

                  07:25:09,439 INFO [SchemaUpdate] Running hbm2ddl schema update
                  07:25:09,439 INFO [SchemaUpdate] fetching database metadata
                  07:25:09,442 INFO [SchemaUpdate] updating schema

                  but the data inside the tables is still flushed, what could be the cause of this problem ?

                  • 6. Re: database flushed on each deploy
                    Stephane PAQUET Newbie

                    Using persistence.xml in the project with works properly