首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

struts2.2-jquery-plugin学习DAO层跟Service层文件(四)

2012-09-17 
struts2.2-jquery-plugin学习DAO层和Service层文件(四)(一)DAO层的写法:DAO接口:package com.newsicom.jxc

struts2.2-jquery-plugin学习DAO层和Service层文件(四)

(一)DAO层的写法:

DAO接口:

package com.newsicom.jxc.basicInfo.goodsUnits.service.imp;import java.util.List;import com.newsicom.jxc.basicInfo.common.model.GoodsUnits;import com.newsicom.jxc.basicInfo.common.util.PageBean;import com.newsicom.jxc.basicInfo.goodsUnits.dao.IGoodsUnitsDao;import com.newsicom.jxc.basicInfo.goodsUnits.service.IGoodsUnitsService;public  class GoodsUnitsService implements IGoodsUnitsService<GoodsUnits> {private IGoodsUnitsDao<GoodsUnits> goodsUnitsDao;public void create(GoodsUnits t) {this.goodsUnitsDao.create(t);}public void save(GoodsUnits transientInstance) {this.goodsUnitsDao.save(transientInstance);}public void delete(GoodsUnits persistentInstance) {this.goodsUnitsDao.delete(persistentInstance);}public GoodsUnits findById(Class<GoodsUnits> clazz, Integer id) {return (GoodsUnits) this.goodsUnitsDao.findById(clazz, id);}public void deleteByID(Integer id) {this.deleteByID(id);}public List<GoodsUnits> findAll() {return this.findAll();}public PageBean<GoodsUnits> getT(String hql, int index, int pageSize) {return this.goodsUnitsDao.getT(hql, index, pageSize);}public List<GoodsUnits> getPageT(String hql, int index, int pageSize) {return this.goodsUnitsDao.getPageT(hql, index, pageSize);}public void update(GoodsUnits t) {this.goodsUnitsDao.update(t);}public void setGoodsUnitsDao(IGoodsUnitsDao<GoodsUnits> goodsUnitsDao) {this.goodsUnitsDao = goodsUnitsDao;}}

?关于DAO和service在applicationContext.xml的配置请查看第二篇文章关于配置

热点排行