⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auctionitemsdaoimpl.java

📁 Struts+Spring+Hibernate实现的在线拍卖系统,去掉了这些组件自身的jar包
💻 JAVA
字号:
package org.bestteam.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bestteam.dao.AuctionItemsDao;
import org.bestteam.domain.AuctionItems;
import org.bestteam.domain.Catalog;
import org.bestteam.domain.MerchandiseInfo;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class AuctionItemsDaoImpl extends HibernateDaoSupport implements
		AuctionItemsDao {

	private static final Log log = LogFactory.getLog(AuctionItemsDao.class);

	public void delete(AuctionItems auctionItems) {
		log.debug("deleting Catalog instance");
		try {
			getHibernateTemplate().delete(auctionItems);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}

	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding AuctionItems instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from AuctionItems where " + propertyName
					+ "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public void save(AuctionItems auctionItems) {
		log.debug("saving Catalog instance");
		try {
			getHibernateTemplate().save(auctionItems);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}

	}

	public AuctionItems saveOrUpdate(AuctionItems auctionItems) {
		log.debug("saveOrUpdate Catalog instance");
		try {
			AuctionItems result = (AuctionItems) getHibernateTemplate().merge(
					auctionItems);
			log.debug("saveOrUpdate successful");
			return result;
		} catch (RuntimeException re) {
			log.error("saveOrUpdate failed", re);
			throw re;
		}
	}

	public List getAllAuctionItem() {
		log.debug("finding AuctionItems instance");
		try {
			String queryString = "from AuctionItems";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List getAllAuctionItem(int from, int size, int catalogID) {
		List list = getSession()
				.createQuery(
						"from MerchandiseInfo as mer where mer.auctionItems.state='T' and mer.catalog.catalogId="
								+ catalogID).setFirstResult(from)
				.setMaxResults(size).list();
		return list;
	}

	public List getAllAuctionItem(int catalogID) {
		List list = getSession()
				.createQuery(
						"from MerchandiseInfo as mer where mer.auctionItems.state='T' and mer.catalog.catalogId="
								+ catalogID).list();
		return list;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -