这是我的hibernate.cfg.xml文件,hbm2ddl.auto属性设置为update,并且如果我的数据库中不存在表,则它不在创建table.hbm2ddl.auto创建正常。
50
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="hibernate.connection.username">root</property> <property
name="hibernate.connection.password">root</property> <property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.max_size">3</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.acquireRetryDelay">1000</property>
<property name="hibernate.c3p0.acquireRetryAttempts">60</property>
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.idle_test_period">14400</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1</property>
<property name="cache.use_second_level_cache">false</property>
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="STUDENT.hbm.xml" />
</session-factory>
</hibernate-configuration>
答案 0 :(得分:0)
在某些使用Oracledb的休眠版本中,更新功能存在一些已知问题,请尝试使用版本5.0或5.1.4之后的版本
Why hbm2ddl.auto 'update' property is not working or how does it works?