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

📄 pclist_imp.java

📁 struts2 dwr spring 集成的例子
💻 JAVA
字号:
package Com.Fjzy.Dao.Pc.Imp;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.weaver.patterns.ThisOrTargetAnnotationPointcut;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import Com.Fjzy.Dao.Pc.PcListDao;
import Com.Fjzy.Model.Pc.PcList;

/**
 * Data access object (DAO) for domain model class PcList.
 * 
 * @see Com.Fjzy.Dao.Pc.Imp.PcList
 * @author MyEclipse Persistence Tools
 */

public class PcList_Imp extends HibernateDaoSupport implements PcListDao {
	private static final Log log = LogFactory.getLog(PcList_Imp.class);
	protected void initDao() {
		// do nothing
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#save(Com.Fjzy.Model.Pc.PcList)
	 */
	public String save(PcList transientInstance) {
		log.debug("saving PcList instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
			return "1";
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#delete(Com.Fjzy.Model.Pc.PcList)
	 */
	public String deletes(int id) {
		PcList model = new PcList();
		if(findById(id)!= null){
			 model = findById(id);
			 System.out.println("对象");
		}
		 
		System.out.println("对象:::"  + model.getGroups());
		log.debug("deleting PcList instance");
		try {
			getHibernateTemplate().delete(model);
			log.debug("delete successful");
			return "1";
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findById(java.lang.Integer)
	 */
	public PcList findById(java.lang.Integer id) {
		log.debug("getting PcList instance with id: " + id);
		try {
			PcList instance = (PcList) getHibernateTemplate().get(
					"Com.Fjzy.Model.Pc.PcList", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByExample(Com.Fjzy.Model.Pc.PcList)
	 */
	public List findByExample(PcList instance) {
		log.debug("finding PcList instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByProperty(java.lang.String, java.lang.Object)
	 */
	public List findByProperty(String propertyName, Object value) {
		log.debug("finding PcList instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from PcList as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByName(java.lang.Object)
	 */
	public List findByName(Object name) {
		return findByProperty(NAME, name);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByIp(java.lang.Object)
	 */
	public List findByIp(Object ip) {
		return findByProperty(IP, ip);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByServer(java.lang.Object)
	 */
	public List findByServer(Object server) {
		return findByProperty(SERVER, server);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByTypes(java.lang.Object)
	 */
	public List findByTypes(Object types) {
		return findByProperty(TYPES, types);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByGroups(java.lang.Object)
	 */
	public List findByGroups(Object groups) {
		return findByProperty(GROUPS, groups);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByBios(java.lang.Object)
	 */
	public List findByBios(Object bios) {
		return findByProperty(BIOS, bios);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findByIsbak(java.lang.Object)
	 */
	public List findByIsbak(Object isbak) {
		return findByProperty(ISBAK, isbak);
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#findAll()
	 */
	public List findAll(String where) {
		log.debug("finding all PcList instances");
		try {
			String queryString = "from PcList where "+ where;
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#merge(Com.Fjzy.Model.Pc.PcList)
	 */
	public PcList merge(PcList detachedInstance) {
		log.debug("merging PcList instance");
		try {
			PcList result = (PcList) getHibernateTemplate().merge(
					detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#attachDirty(Com.Fjzy.Model.Pc.PcList)
	 */
	public void attachDirty(PcList instance) {
		log.debug("attaching dirty PcList instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	/* (non-Javadoc)
	 * @see Com.Fjzy.Dao.Pc.Imp.PcListDao#attachClean(Com.Fjzy.Model.Pc.PcList)
	 */
	public void attachClean(PcList instance) {
		log.debug("attaching clean PcList instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static PcListDao getFromApplicationContext(ApplicationContext ctx) {
		return (PcListDao) ctx.getBean("PcListDAO");
	}


}

⌨️ 快捷键说明

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