弄了半天 (好久哦)
首先 applicationContext-db.xml
package wl.oa.dao;import wl.oa.dao.base.BaseDao;import wl.oa.domain.Person;public interface PersonDaoextends BaseDao { //public void savePerson(Person person);}
package wl.oa.dao.impl;import javax.annotation.Resource;import org.springframework.orm.hibernate3.HibernateTemplate;import org.springframework.stereotype.Repository;import wl.oa.dao.PersonDao;import wl.oa.dao.base.impl.BaseDaoImpl;import wl.oa.domain.Person;@Repository("personDao")public class PersonDaoImpl extends BaseDaoImplimplements PersonDao {// @Resource(name="hibernateTemplate")// private HibernateTemplate hibernateTemplate;// public void savePerson(Person person) {// // TODO Auto-generated method stub// this.hibernateTemplate.save(person);// }}
package wl.oa.service;import wl.oa.domain.Person;import wl.oa.service.base.BaseService;public interface PersonServiceextends BaseService { //public void savePerson(Person person);}
package wl.oa.service.impl;import javax.annotation.Resource;import org.springframework.stereotype.Service;import org.springframework.transaction.annotation.Transactional;import wl.oa.dao.PersonDao;import wl.oa.domain.Person;import wl.oa.service.PersonService;import wl.oa.service.base.impl.BaseServiceImpl;@Service("personService")public class PersonServiceImpl extends BaseServiceImplimplements PersonService { // @Resource(name="personDao")// PersonDao personDao; // public PersonDao getPersonDao() {// return personDao;// }//// public void setPersonDao(PersonDao personDao) {// this.personDao = personDao;// }// @Transactional(readOnly=false)// public void savePerson(Person person) {// // TODO Auto-generated method stub// this.personDao.savePerson(person);// }}