[jboss-user] [EJB 3.0] - Automatic database schema management with JBoss & Hibernate

chenww do-not-reply at jboss.com
Wed Apr 23 11:07:14 EDT 2008


Buddies,

I have an EJB jar that includes a persistence.xml. See it below. I try to deploy the jar and set "hibernate.hbm2ddl.auto=create". However this will cause the schema recreated everytime you restart the JBoss. If I set the property to update, the schema will not get created at the first time. Do you know how to let Hibernate automatically create schema just first time after product installed and loading EntityManagerFactory? I saw people are using ant task to do that but that is not an option as the products are deployed by customers. I guess I could use some Hibernate tools but I could not find in JBoss. I try to see if this needs could be satisfied by just configure something in the persistence.xml.

Thanks & Regards


   <persistence-unit name="MyUnit">
       <jta-data-source>java:/MyDS</jta-data-source>
        
            <!-- property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/-->
            
            org.hibernate.transaction.JBossTransactionManagerLookup
       
   </persistence-unit>


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146226#4146226

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146226



More information about the jboss-user mailing list