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

📄 roomdetaildao.java

📁 有关医院方向的开发
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.woyi.dao;
// default package

import java.text.SimpleDateFormat;
import java.util.Date;
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.woyi.dto.HotelDetailInfo;
import com.woyi.dto.HotelInfo;
import com.woyi.dto.RoomDetail;
import com.woyi.dto.RoomInfo;
import com.woyi.page.PageInfo;
import com.woyi.page.Pagination;

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

public class RoomDetailDAO extends HibernateDaoSupport  {
    private static final Log log = LogFactory.getLog(RoomDetailDAO.class);
	//property constants
	public static final String ROOMS_ID = "roomsId";
	public static final String ROOMS_ID_1 = "roomsId_1";
	public static final String ROOMS_NAME = "roomsName";
	public static final String ROOM_STATUS = "roomStatus";
	public static final String OPTRID = "optrid";
	public static final String CUSTID = "custid";
	public static final String CUSTNAME = "custname";
	public static final String CUSTCERTID = "custcertid";
	public static final String CUSTPHONE = "custphone";
	public static final String CUSTTYPE = "custtype";
	public static final String REMARK = "remark";

	private Pagination pageInfo;
	public Pagination getPageInfo() {
		return pageInfo;
	}

	public void setPageInfo(Pagination pageInfo) {
		this.pageInfo = pageInfo;
	}

	protected void initDao() {
		//do nothing
	}
    
    
    
    public boolean save(RoomDetail transientInstance) {
        log.debug("saving HotelInfo instance");
        boolean isflag = false;
        try {
            getHibernateTemplate().save(transientInstance);
            log.debug("save successful");
            isflag = true;
            return isflag;
        } catch (RuntimeException re) {
            log.error("save failed", re);
            return isflag;
            
        }
    }
    
    
	public boolean delete(RoomDetail persistentInstance) {
        log.debug("deleting HotelDetailInfo instance");
        boolean isflag = false;
        try {
        	 
            getHibernateTemplate().delete(persistentInstance);
            log.debug("delete successful");
            isflag = true;
            return isflag;
        } catch (RuntimeException re) {
            log.error("delete failed", re);
            return isflag;
        }
    }
	
    
    public RoomDetail findById( java.lang.Integer id) {
        log.debug("getting RoomDetail instance with id: " + id);
        try {
            RoomDetail instance = (RoomDetail) getHibernateTemplate()
                    .get("RoomDetail", id);
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
    
    
    public List findByExample(RoomDetail instance) {
        log.debug("finding RoomDetail 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 RoomDetail instance with property: " + propertyName
            + ", value: " + value);
      try {
         String queryString = "from RoomDetail 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 findByRoomsId(Object roomsId) {
		return findByProperty(ROOMS_ID, roomsId);
	}
	
	public List findByRoomsId_1(Object roomsId_1) {
		return findByProperty(ROOMS_ID_1, roomsId_1);
	}
	
	public List findByRoomsName(Object roomsName) {
		return findByProperty(ROOMS_NAME, roomsName);
	}
	
	public List findByRoomStatus(Object roomStatus) {
		return findByProperty(ROOM_STATUS, roomStatus);
	}
	
	public List findByOptrid(Object optrid) {
		return findByProperty(OPTRID, optrid);
	}
	
	public List findByCustid(Object custid) {
		return findByProperty(CUSTID, custid);
	}
	
	public List findByCustname(Object custname) {
		return findByProperty(CUSTNAME, custname);
	}
	
	public List findByCustcertid(Object custcertid) {
		return findByProperty(CUSTCERTID, custcertid);
	}
	
	public List findByCustphone(Object custphone) {
		return findByProperty(CUSTPHONE, custphone);
	}
	
	public List findByCusttype(Object custtype) {
		return findByProperty(CUSTTYPE, custtype);
	}
	
	public List findByRemark(Object remark) {
		return findByProperty(REMARK, remark);
	}
	

	public List findAll() {
		log.debug("finding all RoomDetail instances");
		try {
			String queryString = "from RoomDetail";
		 	return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}
	
    public RoomDetail merge(RoomDetail detachedInstance) {
        log.debug("merging RoomDetail instance");
        try {
            RoomDetail result = (RoomDetail) getHibernateTemplate()
                    .merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

    
    
    public boolean attachDirty(RoomDetail instance) {
        log.debug("attaching dirty HotelInfo instance");
        boolean isflag = false;
        try {
            getHibernateTemplate().saveOrUpdate(instance);
            log.debug("attach successful");
            isflag = true;
            return isflag;
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            return isflag;
        }
    }
    
    public void attachClean(RoomDetail instance) {
        log.debug("attaching clean RoomDetail instance");
        try {
            getHibernateTemplate().lock(instance, LockMode.NONE);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);

⌨️ 快捷键说明

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