Spring注解实例

public class ActivityAction extends CoreAction {
	
	private static final Logger log = Logger.getLogger(ActivityAction.class);
	
	@Autowired
	private ActivityMng activityMng;

  

@Service
@Transactional
public class ActivityMngImpl extends CoreManagerImpl<Activity> implements ActivityMng{
	@Autowired
	public void setDao(ActivityDao dao) {
		super.setDao(dao);
	}

	public ActivityDao getDao() {
		return (ActivityDao) super.getDao();
	}

	public Activity findByName(String name) {
		return getDao().findByName(name);
	}

  

import org.springframework.stereotype.Repository;

import com.leadtone.ssh2.core.CoreDaoImpl;
import com.wangzhongsoft.fanliwang.activity.activity.dao.ActivityDao;
import com.wangzhongsoft.fanliwang.activity.activity.entity.Activity;
@Repository
public class ActivityDaoImpl extends CoreDaoImpl<Activity> implements ActivityDao {

	public Activity findByName(String name) {
		String hql="from Activity a where a.name like '%"+name+"%'";
		return (Activity) findUnique(hql);
	}

}

  

posted on 2015-04-28 06:22  锟斤拷锟斤拷  阅读(220)  评论(0编辑  收藏  举报

导航