当前位置: 代码迷 >> J2EE >> could not resolve property: UserID of: com.Bean.Products [from com.Bean.Products解决办法
  详细解决方案

could not resolve property: UserID of: com.Bean.Products [from com.Bean.Products解决办法

热度:559   发布时间:2016-04-17 23:52:09.0
could not resolve property: UserID of: com.Bean.Products [from com.Bean.Products
Products.java:
public class Products {
private  Integer productID;
private  String productName;
private  Integer userID;
private  String picture;
private  Integer counts;
private  Float price;
private  String productDsc;
private  Integer parentID;
               //getter&setter&construter
xml:
<class name="com.Bean.Products" table="products">
  <id name="productID" type="java.lang.Integer">
   <column name="productID"></column>
   <generator class="native"></generator>
  </id>
  <property name="parentID" type="java.lang.Integer">
   <column name="parentID"></column>
  </property>
  <property name="userID" type="java.lang.Integer">
   <column name="userID"></column>
  </property>
  <property name="counts" type="java.lang.Integer">
  <column name="counts"></column>
  </property>
  <property name="price" type="java.lang.Float">
  <column name="price"></column>
  </property>
  <property name="productDsc" type="java.lang.String">
  <column name="productDsc"></column>
  </property>
  <property name="picture" type="java.lang.String">
  <column name="picture"></column>
  </property>
  <property name="productName" type="java.lang.String">
  <column name="productName"></column>
  </property>
 </class>
DALProducts.java:
public  List  findProductsByUserID(int id) {
String sql="from Products p where p.UserID=?";
List list=new ArrayList();
//test
if (this.getHibernateTemplate()==null) {
System.out.println("get null value!");
}
list = this.getHibernateTemplate().find(sql,new Integer(id));
return list;
}配置文件感觉没有错啊 麻烦大神们帮忙看下!
------解决方案--------------------
UserID   在这个实体类中没有找到,去看下他的实体类,或者发下出来  我们看下!~xml文件是对的
------解决方案--------------------
实体类中有没有这个属性?
  相关解决方案