hibernate报错:Could not parse 地图ping document from resource
hibernate报错:Could not parse mapping document from resource
望高手指点
运行后报错:Could not parse mapping document from resource
相关代码如下:
数据库:
create table Login(
username varchar2(20) primary key,
password varchar2(20)
);
hibernate.cfg.xml
<?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>
<!-- Database connection settings -->
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcllib</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.username">myhr</property>
<property name="hibernate.connection.password">zls</property>
<mapping resource="com/pb/hibernate/po/Login.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Login.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping >
<class name="com.pb.hibernate.po.Login" table="LOGIN" schema="myhr">
<id name="userName" type="java.lang.String">
<colum name="USERNAME" length="20" />
<generator class="assigned" />
</id>
<property name="password" type="java.lang.String">
<colum name="PASSWORD" length="20" not-null="true"/>
</property>
</class>
</hibernate-mapping>
HibernateUtil.java
package com.pb.hibernate.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
Configuration config = new Configuration().configure();
sessionFactory = config.buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed." + ex);
望高手指点
运行后报错:Could not parse mapping document from resource
相关代码如下:
数据库:
create table Login(
username varchar2(20) primary key,
password varchar2(20)
);
hibernate.cfg.xml
<?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>
<!-- Database connection settings -->
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcllib</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.username">myhr</property>
<property name="hibernate.connection.password">zls</property>
<mapping resource="com/pb/hibernate/po/Login.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Login.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping >
<class name="com.pb.hibernate.po.Login" table="LOGIN" schema="myhr">
<id name="userName" type="java.lang.String">
<colum name="USERNAME" length="20" />
<generator class="assigned" />
</id>
<property name="password" type="java.lang.String">
<colum name="PASSWORD" length="20" not-null="true"/>
</property>
</class>
</hibernate-mapping>
HibernateUtil.java
package com.pb.hibernate.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
Configuration config = new Configuration().configure();
sessionFactory = config.buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed." + ex);