JBoss Community

Persistence provider creating new table even with update option

created by Mitesh pandey in EJB3 - View the full discussion

Hi All,

 

I am using hibernate as my persistence provider and postgre as my DB.

 

My persistence.xml looks like below

 

<persistence-unit name="titan" transaction-type="JTA">

           <provider>org.hibernate.ejb.HibernatePersistence</provider>

           <jta-data-source>java:PostgresDS</jta-data-source>

           <class>com.domain.Cabin</class>

           <class>com.domain.Customer</class>

           <class>com.domain.Address</class>

          <properties>

                    <property name="hibernate.dialect" value=  "org.hibernate.dialect.PostgreSQLDialect" />

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

                     <property name="hibernate.show_sql" value="true" />

                     <property name="hibernate.format_sql" value="false" />

                     <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>

                     <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/Entity"/>

                     <property name="hibernate.connection.username" value="*****"/>

                     <property name="hibernate.connection.password" value="****"/>

      </properties>

</persistence-unit>

 

I have table Cabin, Customer and Address under my table Entity. When i deploy my jar and start the server , again a new table is created  as cabin, customer and address. :0 I thought with value = "update"  for  hibernate.hbm2ddl.auto, it should not create any table and should only update the data.

 

When i deleted the table from DB, then there was no table found message when the jboss is up. I don't want to duplicate the tables.

 

What could be the issue ?

Reply to this message by going to Community

Start a new discussion in EJB3 at Community