package dream.ourshopping.persistence;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Transaction;
import org.hibernate.criterion.Example;
import dream.ourshopping.domain.Product;
/**
* Data access object (DAO) for domain model class Product.
*
* @see com.study.hibernate.Product
* @author MyEclipse - Hibernate Tools
*/
public class ProductDAO extends BaseHibernateDAO {
private static Logger log = Logger.getLogger(ProductDAO.class.getName());
// property constants
public static final String SORTID = "sortid";
public static final String NAME = "name";
public static final String PRICE = "price";
public static final String SALEPRICE = "saleprice";
public static final String DESCRIPT = "descript";
public static final String CONTENTS = "contents";
public static final String SALECOUNT = "salecount";
public static final String IMAGE = "image";
public void save(Product transientInstance) {
log.debug("添加商品");
try {
getSession().save(transientInstance);
log.debug("添加商品");
} catch (RuntimeException re) {
log.error("添加商品出错", re);
throw re;
}
}
public void delete(int id) {
log.debug("根据ID删除商品 "+id);
try {
Query q = get
javaweb对商品名的模糊查询(附源码)
最新推荐文章于 2022-07-08 19:55:51 发布