?? valuelistdaoimpl.java
字號:
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -