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

📄 topicdao.java

📁 一个网上购物商城系统
💻 JAVA
字号:
package tarena.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

import tarena.entity.Topic;

/**
 * Data access object (DAO) for domain model class Topic.
 * 
 * @see tarena.entity.Topic
 * @author MyEclipse Persistence Tools
 */

public class TopicDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory.getLog(TopicDAO.class);

	// property constants
	public static final String ISLOCK = "islock";

	public static final String LOCKUSER = "lockuser";

	public static final String TOPICTYPE = "topictype";

	public static final String DIGEST = "digest";

	public static final String DEGESTUSER = "degestuser";

	public static final String HIGHLIGHT = "highlight";

	public static final String LIGHTCOLOR = "lightcolor";

	public static final String LIGHTUSER = "lightuser";

	public static final String LETTOP = "lettop";

	public static final String LETTOPAREA = "lettoparea";

	public static final String LETTOPUSER = "lettopuser";

	public static final String VOTE = "vote";

	public static final String VOTEUSER = "voteuser";

	public static final String VIEWNUM = "viewnum";

	public void save(Topic transientInstance) {
		log.debug("saving Topic instance");
		try {
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(Topic persistentInstance) {
		log.debug("deleting Topic instance");
		try {
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public Topic findById(java.lang.Integer id) {
		log.debug("getting Topic instance with id: " + id);
		try {
			Topic instance = (Topic) getSession()
					.get("tarena.entity.Topic", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(Topic instance) {
		log.debug("finding Topic instance by example");
		try {
			List results = getSession().createCriteria("tarena.entity.Topic")
					.add(Example.create(instance)).list();
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding Topic instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from Topic as model where model."
					+ propertyName + "= ?";
			Query queryObject = getSession().createQuery(queryString);
			queryObject.setParameter(0, value);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByIslock(Object islock) {
		return findByProperty(ISLOCK, islock);
	}

	public List findByLockuser(Object lockuser) {
		return findByProperty(LOCKUSER, lockuser);
	}

	public List findByTopictype(Object topictype) {
		return findByProperty(TOPICTYPE, topictype);
	}

	public List findByDigest(Object digest) {
		return findByProperty(DIGEST, digest);
	}

	public List findByDegestuser(Object degestuser) {
		return findByProperty(DEGESTUSER, degestuser);
	}

	public List findByHighlight(Object highlight) {
		return findByProperty(HIGHLIGHT, highlight);
	}

	public List findByLightcolor(Object lightcolor) {
		return findByProperty(LIGHTCOLOR, lightcolor);
	}

	public List findByLightuser(Object lightuser) {
		return findByProperty(LIGHTUSER, lightuser);
	}

	public List findByLettop(Object lettop) {
		return findByProperty(LETTOP, lettop);
	}

	public List findByLettoparea(Object lettoparea) {
		return findByProperty(LETTOPAREA, lettoparea);
	}

	public List findByLettopuser(Object lettopuser) {
		return findByProperty(LETTOPUSER, lettopuser);
	}

	public List findByVote(Object vote) {
		return findByProperty(VOTE, vote);
	}

	public List findByVoteuser(Object voteuser) {
		return findByProperty(VOTEUSER, voteuser);
	}

	public List findByViewnum(Object viewnum) {
		return findByProperty(VIEWNUM, viewnum);
	}

	public List findAll() {
		log.debug("finding all Topic instances");
		try {
			String queryString = "from Topic";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public Topic merge(Topic detachedInstance) {
		log.debug("merging Topic instance");
		try {
			Topic result = (Topic) getSession().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(Topic instance) {
		log.debug("attaching dirty Topic instance");
		try {
			getSession().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(Topic instance) {
		log.debug("attaching clean Topic instance");
		try {
			getSession().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}
}

⌨️ 快捷键说明

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