?? configtreedaoimpl.java
字號:
package com.yuanchung.sales.dao.config;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.yuanchung.sales.model.config.ConfigTree;
public class ConfigTreeDAOImpl extends HibernateDaoSupport implements
ConfigTreeDAO {
private static Logger logger = Logger.getLogger(ConfigTreeDAOImpl.class);
public void save(ConfigTree configTree) {
try {
getHibernateTemplate().save(configTree);
} catch (RuntimeException re) {
throw re;
}
}
public void delete(ConfigTree configTree) {
try {
getHibernateTemplate().delete(configTree);
} catch (RuntimeException re) {
throw re;
}
}
public ConfigTree findById(java.lang.Integer id) {
logger.debug("from ConfigTree find by Id " + id);
try {
return (ConfigTree) getHibernateTemplate()
.get(ConfigTree.class, id);
} catch (RuntimeException re) {
logger.error("from ConfigTree find by id failed");
throw re;
}
}
public List findByExample(ConfigTree configTree) {
return null;
}
public List findByProperty(String propertyName, Object value) {
return null;
}
public void modifyTable(String tableName, String fieldName, String value1,
String value2) {
String sqlstr = "update " + tableName + " set " + fieldName + "='"
+ value2 + "' where " + fieldName + "='" + value1 + "'";
try {
Query query = getSession().createQuery(sqlstr);
query.executeUpdate();
} catch (RuntimeException re) {
throw re;
}
}
public int lockUpTableDate(String tableName, String fieldName, String value) {
String sqlstr = "select count(" + fieldName + ") from " + tableName
+ " model where model." + fieldName + "='" + value + "'";
try {
Query query = getSession().createQuery(sqlstr);
Object o = (Object) query.list().get(0);
String i = "0";
i = o.toString();
logger.debug("i======" + i);
return Integer.parseInt(i);
} catch (RuntimeException re) {
throw re;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -