分类:
2008-09-09 12:48:37
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
implements EntityDao
protected Class
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
{
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
{
return getHibernateTemplate().find(hql, values);
}
/**
* save the object input
* @param o
*/
[1]