MyException - 我的异常网
当前位置:我的异常网» Java相关 » Caused by: org.hibernate.PropertyNotFoundExcepti

Caused by: org.hibernate.PropertyNotFoundException: field not (2)

www.MyException.Cn  网友分享于:2013-11-26  浏览:1662次

at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
... 8 more
============================================================================================
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">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">scott</property>
<property name="connection.url">
jdbc:oracle:thin:@127.0.0.1:1521:liang
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">orale</property>
<property name="connection.password">tiger</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="com/shop/pojo/Manager.hbm.xml" />
 
<mapping resource="com/shop/pojo/User.hbm.xml" />
<mapping resource="com/shop/pojo/Dpt.hbm.xml" />

</session-factory>

</hibernate-configuration>
===================================================================================================
实体类
public class Manager {
//标识
public Long m_id ;
//登录用户名
public String m_username ;
//登录密码
public String m_password ;
//真实姓名
public String name ;
//注册时间
public Date logDate ;
//构造器
public Manager() {
super();
}
//标识m_id的getter和setter方法
public Long getM_id() {
return m_id;
}
public void setM_id(Long m_id) {
this.m_id = m_id;
}
//m_username的getter和setter方法
public String getM_username() {
return m_username;
}
public void setM_username(String m_username) {
this.m_username = m_username;
}
//m_password的getter和setter方法
public String getM_password() {
return m_password;
}
public void setM_password(String m_password) {
this.m_password = m_password;
}
//name的getter和setter方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//logdate的getter和setter方法
public Date getLogDate() {
return logDate;
}
public void setLogDate(Date logDate) {
this.logDate = logDate;
}

}
=============================================================================================
配置文件
<?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 package="com.shop.pojo">
  <class name="Manager" table="SHOP_MANAGER" schema="SCOTT">
  <id name="m_id">
  <generator class="native" />
  </id>
  <property name="m_username" not-null="true"/>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有