标签:seh jsb logs xtend list desc sed repo creat
所有的dao层可以有个superDao
比如:BaseHibernateDao
继承的类是hibernate4
public class BaseHibernateDao extends HibernateDaoSupport{ @Resource(name="jsbcTemplate") protected JdbcTemlate jdbcTemplate; @Resource(name="sessionFactory") public void setSF(SessionFactory sessionFactory){ this.setSessionFactory(sessionFactory); } }
其他dao层继承这个baseDao就行了,例如:其他dao
@Repository public class PlatUserDao extends BaseHibernateDao{ public void savePlatUser(PlatUser platUser){ this.getHibernateTemplate().saveOrUpdate(platUser); } public List<PlatUser> getPlatUserList(){ List<PlatUser> results=null; results=getHibernateTemplate().execute({ @override public List<PlatUser> doInHibernate(Session session) throws HibernateException{ String hql="from PlatUser p order by p.id desc"; Query query =session.createQuery(hql); return query.list(); } }); return results; } }
标签:seh jsb logs xtend list desc sed repo creat
原文地址:http://www.cnblogs.com/bxslovewxs/p/7365728.html