package dao; // default package 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 pojobean.Buyinfo; /** * A data access object (DAO) providing persistence and search support for * Buyinfo entities. Transaction control of the save(), update() and delete() * operations can directly support Spring container-managed transactions or they * can be augmented to handle user-managed Spring transactions. Each of these * methods provides additional information for how to configure it for the * desired type of transaction control. * * @see .Buyinfo * @author MyEclipse Persistence Tools */ public class BuyinfoDAO extends HibernateDaoSupport { private static final Log log = LogFactory.getLog(BuyinfoDAO.class); protected void initDao() { // do nothing } public void save(Buyinfo transientInstance) { log.debug("saving Buyinfo instance"); try { getHibernateTemplate().save(transientInstance); log.debug("save successful"); } catch (RuntimeException re) { log.error("save failed", re); throw re; } } public void delete(Buyinfo persistentInstance) { log.debug("deleting Buyinfo instance"); try { getHibernateTemplate().delete(persistentInstance); log.debug("delete successful"); } catch (RuntimeException re) { log.error("delete failed", re); throw re; } } public Buyinfo findById(java.lang.Integer id) { log.debug("getting Buyinfo instance with id: " + id); try { Buyinfo instance = (Buyinfo) getHibernateTemplate().get("Buyinfo", id); return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } } public List findByExample(Buyinfo instance) { log.debug("finding Buyinfo 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, Object value) { log.debug("finding Buyinfo instance with property: " + propertyName + ", value: " + value); try { String queryString = "from Buyinfo 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 findAll() { log.debug("finding all Buyinfo instances"); try { String queryString = "from Buyinfo"; return getHibernateTemplate().find(queryString); } catch (RuntimeException re) { log.error("find all failed", re); throw re; } } public Buyinfo merge(Buyinfo detachedInstance) { log.debug("merging Buyinfo instance"); try { Buyinfo result = (Buyinfo) getHibernateTemplate().merge( detachedInstance); log.debug("merge successful"); return result; } catch (RuntimeException re) { log.error("merge failed", re); throw re; } } public void attachDirty(Buyinfo instance) { log.debug("attaching dirty Buyinfo instance"); try { getHibernateTemplate().saveOrUpdate(instance); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void attachClean(Buyinfo instance) { log.debug("attaching clean Buyinfo instance"); try { getHibernateTemplate().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public static BuyinfoDAO getFromApplicationContext(ApplicationContext ctx) { return (BuyinfoDAO) ctx.getBean("BuyinfoDAO"); } }
最近下载更多
mmmmmmppp LV10
2022年12月31日
xudong_y LV4
2022年11月7日
文成1116 LV21
2022年10月25日
yijie110 LV5
2022年9月8日
zhaoyangwfd LV17
2022年6月21日
testuser1234567 LV24
2022年5月23日
2310573421 LV7
2022年4月23日
wanglinddad LV53
2022年3月28日
小五12345 LV13
2022年3月18日
edward_vic LV2
2022年3月9日
最近浏览更多
全栈小白 LV32
3月26日
fffffffanan LV1
3月2日
yenaever
1月4日
暂无贡献等级
xiaomii LV3
2023年12月12日
WBelong LV6
2023年12月11日
SovereignJet LV3
2023年10月29日
微信网友_6655384758161408
2023年9月18日
暂无贡献等级
wersdfs LV1
2023年9月14日
taoshen95 LV14
2023年8月23日
爱吃鱼的猫Vital LV6
2023年7月28日