- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
package com.utstar.nms.vmm.spring.dao;
import java.io.Serializable;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.utstar.nms.vmm.spring.util.GenericsUtils;
public class HibernateEntityDao extends HibernateDaoSupport
implements EntityDao {
protected Class entityClass;
public HibernateEntityDao() {
entityClass = GenericsUtils.getSuperClassGenricType(getClass());
}
/**
* find an object by its id
* @param id
* @return an object
*/
public T findByID(Serializable id) {
return (T) getHibernateTemplate().get(entityClass, id);
}
/**
* @return find all objects
*/
public List findAll()
{
return getHibernateTemplate().loadAll(entityClass);
}
/**
* find objects by sql(jdbc) or hql(hibernate)
* @param ql
* @param values parameter that
* @return an objects list of the query result
*/
public List findByQL(String hql, Object... values)
{
return getHibernateTemplate().find(hql, values);
}
/**
* save the object input
* @param o
*/||| public void save(Object object)
{
getHibernateTemplate().save(object);
}
/**
* update the object input
* @param o
*/
public void update(Object object)
{
getHibernateTemplate().update(object);
}
/**
* saveOrUpdate the object input
* @param o
*/
public void saveOrUpdate(Object object)
{
getHibernateTemplate().saveOrUpdate(object);
}
/**
* delete the object input
* @param o
*/
public void remove(Object object)
{
/*delete the object*/
getHibernateTemplate().delete(object);
}
/**
* delete an object by its id
* @param id
*/
public void removeById(Serializable id)
{
/*find the object by id*/
Object object=findByID(id);
/*delete the object*/
remove(object);
责编:罗莉
上一篇:java中的双缓冲技术
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>