valuelistdaoimpl.java
来自「基于Sturts+Spring+Hibernate的一个高级销售管理系统。内容丰」· Java 代码 · 共 98 行
JAVA
98 行
package com.yuanchung.sales.dao.config;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.yuanchung.sales.model.config.FieldList;
import com.yuanchung.sales.model.config.ValueList;
public class ValueListDAOImpl extends HibernateDaoSupport implements ValueListDAO {
private static Logger logger = Logger.getLogger(ValueListDAOImpl.class);
public void save(ValueList valueList) {
try{
getHibernateTemplate().save(valueList);
}catch(RuntimeException re){
logger.error("save object valueList failed");
throw re;
}
}
public void delete(ValueList valueList) {
try{
getHibernateTemplate().delete(valueList);
}catch(RuntimeException re){
logger.error("delete object valueList failed");
throw re;
}
}
public ValueList fingById(Integer id) {
try{
return (ValueList)getHibernateTemplate().get("com.yuanchung.sales.model.config.ValueList", id);
}catch(RuntimeException re){
throw re;
}
}
public List findByExample(ValueList valueList) {
try{
return getHibernateTemplate().findByExample(valueList);
}catch(RuntimeException re){
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
logger.debug("from ValueList as model where model."+propertyName+"="+value);
try {
String queryString = "from ValueList as model where model."
+ propertyName + "= ? order by model.orderNO";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
logger.error("find by property name failed", re);
throw re;
}
}
public List findByField(FieldList fieldList){
return findByProperty("fieldList", fieldList);
}
public void update(ValueList valueList){
try{
getHibernateTemplate().saveOrUpdate(valueList);
}catch(RuntimeException re){
throw re;
}
}
public List findByOrderNO(Integer orderNO){
return findByProperty("orderNO", orderNO);
}
public List findByNotEId(Integer id){
try {
String queryString = "from ValueList as model where model.id != ? order by model.orderNO";
return getHibernateTemplate().find(queryString, id);
} catch (RuntimeException re) {
logger.error("find by not eq id failed", re);
throw re;
}
}
public ValueList findByListValue(String listValue){
try{
int i = findByProperty("listValue", listValue).size();
if(i==0){
ValueList valueList = null;
return valueList;
}
return (ValueList)findByProperty("listValue", listValue).get(0);
}catch(RuntimeException re){
throw re;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?