我是Hibernate的新手....我尝试了这段代码,但我得到了Could not parse configuration: NewFile.cfg.xml
(.cfg.xml文件的名称)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- connection to oracle -->
<propertyname="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver </property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE
</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.username">system</property>
<property name="hibernate.connection.password">system</property>
<!-- autocommit -->
<property name="hibernate.connection.autocommit">false</property>
<!-- to display sql query generated while running program -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
<!-- for jdbc transaction -->
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.
JDBCTransactionFactory</property>
<!-- mapping file -->
<mapping resource="Mapping.hbm.xml"/>
</session-factory>
答案 0 :(得分:1)
<hibernate-configuration>
的结束标记丢失了:
</hibernate-configuration>
答案 1 :(得分:0)
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver </property>
您的开场代码与结束代码不匹配。