enter image description hereThis is my project我的配置文件是無法找到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> <!-- Related to the connection START --> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver </property> <property name="connection.url">jdbc:oracle:thin:@localhost:3306:XE</property> <property name="connection.user">root</property> <property name="connection.password">maherukh</property> <!-- Related to the connection END --> <!-- Related to hibernate properties START --> <property name="show_sql">true </property> <property name="dialet">org.hibernate.dialect.OracleDialect </property> <property name="hbm2ddl.auto">update </property> <!-- Related to hibernate properties END --> <!-- Related to mapping START --> <mapping resource="Product.hbm.xml" /> <!-- Related to the mapping END --> </session-factory> </hibernate-configuration>][2]
我Hibernate映射文件
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="Product" table="PRODUCTS"> <id name="productId" column="pid" > <generator class="assigned" /> </id> <property name="proName" column="pname" /> <property name="price"/> </class> </hibernate-mapping>
異常線程「main 「org.hibernate.MappingNotFoundException:資源:Product.hbm.xml找不到 \t在org.hibernate.cfg.Configuration.addResource(Configuration.java:517) \t在org.hibernate.cfg.Configuration.parseMappingElement(配置。 java:1511) \t at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479) – Mahe
^^^^這是它給予的錯誤。 – Mahe
也請檢查我已添加的屏幕截圖。 – Mahe