0

I have deployed an application with hibernate.hbm2ddl.auto = create and found that many of my tables were dropped! I used to do the same thing but using EclipseLink instead of Hibernate, the database return table already exists witch means that it only launchs the create table. I suspect that having hibernate.hbm2ddl.auto set to "create" if dropping and then create the table.

any one can confirm my doubts? Thanks for help.

Rachid
  • 165
  • 2
  • 5
  • 16

1 Answers1

0

This is my hibernate configuration file and it works.

<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">org.h2.Driver</property>
        <property name="connection.url">jdbc:h2:tcp://localhost/mem:test:MVCC=true;INIT=create schema IF NOT EXISTS OVT;DB_CLOSE_DELAY=10</property>
        <property name="connection.username">sa</property>
        <property name="connection.password"></property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">100</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.H2Dialect</property>

        <!-- Disable the second-level cache -->
        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
        <property name="hbm2ddl.auto">create</property>

        <mapping class="model.concretes.varlik.Tasit" />
        <mapping class="model.concretes.varlik.Kisi" />
        <mapping class="model._framework.concretes.varlik.Log" />
        <mapping class="model._framework.concretes.varlik.Yetki" />
    </session-factory>
</hibernate-configuration>
erk
  • 1
  • 2