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;
}配置文件感觉没有错啊 麻烦大神们帮忙看下!