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

📄 types_imp.java

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

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

import Com.Fjzy.Dao.SmsType.SmsType_dao;
import Com.Fjzy.Model.SmsType.Types;

/**
 * Data access object (DAO) for domain model class Types.
 * 
 * @see Com.Fjzy.Model.SmsType.Types
 * @author MyEclipse Persistence Tools
 */

public class Types_Imp extends HibernateDaoSupport implements SmsType_dao {
	private static final Log log = LogFactory.getLog(Types_Imp.class);
	// property constants
	public static final String TYPE = "type";
	public static final String NAME = "name";

	protected void initDao() {
		// do nothing
	}

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

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

	public Types findById(java.lang.Integer id) {
		log.debug("getting Types instance with id: " + id);
		try {
			Types instance = (Types) getHibernateTemplate().get(
					"Com.Fjzy.Model.SmsType.Types", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(Types instance) {
		log.debug("finding Types 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;
		}
	}

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

	public List findByType(String type) {
		System.out.println("这里" + type);
		return findByProperty(TYPE, type);
	}

	public List findByName(String name) {
		return findByProperty(NAME, name);
	}

	public List findAll(String where) {
		log.debug("finding all Types instances");
		List list = new ArrayList();
		try {
			String queryString = "from Types where " + where;
			list = getHibernateTemplate().find(queryString);
			
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
		return list;
	}

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

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

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

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

	public String getError() {
		log.info("sdfdsfdfsdsf");
		
		return "sdfdsffsf";
	}	
}

⌨️ 快捷键说明

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