📄 hotelinfodao.java
字号:
package com.woyi.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 com.woyi.dto.HotelInfo;
import com.woyi.page.PageInfo;
import com.woyi.page.Pagination;
/**
* Data access object (DAO) for domain model class HotelInfo.
* @see .HotelInfo
* @author MyEclipse Persistence Tools
*/
public class HotelInfoDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(HotelInfoDAO.class);
//property constants
public static final String HOTELS_ID1 = "hotelsId1";
public static final String HOTELNAME = "hotelname";
public static final String HOTELSIZE = "hotelsize";
public static final String HOTELPRICE = "hotelprice";
public static final String HOTELFLOOR = "hotelfloor";
public static final String HOTELLEVEL = "hotellevel";
public static final String OPTRID = "optrid";
public static final String REMARK = "remark";
private Pagination pageInfo;
protected void initDao() {
//do nothing
}
public boolean save(HotelInfo 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(HotelInfo persistentInstance) {
log.debug("deleting HotelInfo 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 HotelInfo findById( java.lang.Integer id) {
log.debug("getting HotelInfo instance with id: " + id);
try {
HotelInfo instance = (HotelInfo) getHibernateTemplate()
.get("HotelInfo", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(HotelInfo instance) {
log.debug("finding HotelInfo 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 HotelInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from HotelInfo 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 findByHotelsId1(Object hotelsId1) {
return findByProperty(HOTELS_ID1, hotelsId1);
}
public List findByHotelname(Object hotelname) {
return findByProperty(HOTELNAME, hotelname);
}
public List findByHotelsize(Object hotelsize) {
return findByProperty(HOTELSIZE, hotelsize);
}
public List findByHotelprice(Object hotelprice) {
return findByProperty(HOTELPRICE, hotelprice);
}
public List findByHotelfloor(Object hotelfloor) {
return findByProperty(HOTELFLOOR, hotelfloor);
}
public List findByHotellevel(Object hotellevel) {
return findByProperty(HOTELLEVEL, hotellevel);
}
public List findByOptrid(Object optrid) {
return findByProperty(OPTRID, optrid);
}
public List findByRemark(Object remark) {
return findByProperty(REMARK, remark);
}
public List findAll() {
log.debug("finding all HotelInfo instances");
try {
String queryString = "from HotelInfo";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public HotelInfo merge(HotelInfo detachedInstance) {
log.debug("merging HotelInfo instance");
try {
HotelInfo result = (HotelInfo) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public boolean attachDirty(HotelInfo 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(HotelInfo instance) {
log.debug("attaching clean HotelInfo instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
/**
* 查询单个客房信息
* @param propertyName
* @param value
* @return
*/
public List findSingleHotelInfo(Integer hotelsId) {
try {
String queryString = "from HotelInfo as model where model.hotelsId="
+ hotelsId;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -