程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> JAVA綜合教程 >> 【轉】not found while looking for property錯誤,lookingproperty

【轉】not found while looking for property錯誤,lookingproperty

編輯:JAVA綜合教程

【轉】not found while looking for property錯誤,lookingproperty


原址:http://blog.csdn.net/y3wegy/article/details/7840813

 

最近在研究Hibernate。過程當中碰到了很多問題啊!其中一個就是not found while looking for property錯誤

Caused by: org.hibernate.MappingException: class main.java.POJO.User not found while looking for property: id

配置文件如下:

<?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 package="main.java.POJO">
<class name="User" table="loginuser">
     <id name="id" column="Id" >
         <generator class="native"/>
     </id>
     <property name="username" column="username"  />
     <property name="password" column="password" />
     <property name="sex" column="sex"  />
</class>
</hibernate-mapping>

 

修改成:

<?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 package="main.java.POJO">
<class name="User" table="loginuser">
     <id name="id" column="Id"  type="java.lang.Integer">
         <generator class="native"/>
     </id>
     <property name="username" column="username"  type="java.lang.String"/>
     <property name="password" column="password"  type="java.lang.String"/>
     <property name="sex" column="sex"  type="java.lang.String"/>
</class>
</hibernate-mapping>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved