我已将hbm2dll.auto属性设置为在我的配置文件中创建。
<property name="hibernate.hbm2ddl.auto">create</property>
每当我创建SessionFactory时,它会删除表(如果已经创建),但它没有重新创建表,导致我的程序因此异常终止:
java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
是否因为某些数据库权限问题?我使用Oracle 11g作为数据库。
更新:Hibernate配置文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@host:port:database</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.default_schema">myschema</property>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<mapping class="com.vat.annot.user.DBUser"></mapping>
</session-factory>
</hibernate-configuration>