📄 catalogdaoimpl.java
字号:
package org.bestteam.dao.impl;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bestteam.dao.CatalogDao;
import org.bestteam.domain.Catalog;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class CatalogDaoImpl extends HibernateDaoSupport implements CatalogDao {
private static final Log log = LogFactory.getLog(CatalogDaoImpl.class);
public boolean delete(Catalog catalog) {
log.debug("deleting Catalog instance");
try {
getHibernateTemplate().delete(catalog);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
return false;
}
return true;
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Catalog instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Catalog where "
+ propertyName + " is ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByPropertyIsNull(String propertyName){
log.debug("finding Catalog instance ");
try {
String queryString = "from Catalog where "
+ propertyName + " is null";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public boolean save(Catalog catalog) {
log.debug("saving Catalog instance");
try {
getHibernateTemplate().save(catalog);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
return false;
}
return true;
}
public boolean saveOrUpdate(Catalog catalog) {
log.debug("saveOrUpdate Catalog instance");
try {
getHibernateTemplate().merge(catalog);
log.debug("saveOrUpdate successful");
} catch (RuntimeException re) {
log.error("saveOrUpdate failed", re);
return false;
}
return true;
}
public List getAllCatalog() {
log.debug("finding Catalog instance");
try {
String queryString = "from Catalog" ;
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find failed", re);
throw re;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -