hibernate自动删除以前的表
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="foo">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:test</property>
<property name="hibernate.connection.username">test</property>
<property name="hibernate.connection.password">test</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hiernate.hbm2ddl.auto">validate</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="com/asm/hibernate/domain/Student.hbm.xml"/>
<mapping resource="com/asm/hibernate/domain/Teacher.hbm.xml"/>
</session-factory>
</hibernate-configuration>
这是我的hibernate.cfg.xml文件,不管我把hbm2ddl.auto配置成什么值,结果都会把以前建的表删除掉。我的java代表中并没有创建表的语句,请问这是为什么啊????
小弟刚学hibernate,请大侠们帮帮忙,只用到hibernate,没有struts spring.
...全文
相关推荐
详解hibernate自动创建表的配置
详解hibernate自动创建表的配置 配置自动创建表: update//首次创建项目时用,项目稳定后一般注释这里有4个值: update:表示自动根据model对象来更新表结构,启动hibernate时会自动检查数据库,如果缺少表,则自动建表;如果表里缺少列,则自动添加列。 还有其他的参数: create:启动hibernate时,自动删除原来的表,新建所有的表,所以每次启动后的以前数据都会丢失。 create-drop:启动hibernate时,自动创建表,程序关闭时,自动把相应的表都删除。所以程序
自动在数据库中建成表(Hibernate)
只要在实体类中写好属性,他就会自动在数据库中建成你所想要的表,很不错的奥,可以看下啊!!!
Hibernate通过配置文件自动生成表
Hibernate通过配置文件自动生成表
Hibernate自动生成表demo
Hibernate运用Annotation由实体类自动在数据库中生成对应的表
关于Hibernate级联删除的问题.doc
关于Hibernate级联删除的问题.doc


