package com.xxxxxxx.drvpp.biz.web.xyz.business;

import java.util.Date;

import org.apache.ibatis.session.SqlSession;

import com.xxxxxxx.drvpp.biz.web.xyz.domain.Pet;
import com.xxxxxxx.drvpp.fw.common.log.Logger;
import com.xxxxxxx.drvpp.fw.web.util.Business;
import com.xxxxxxx.drvpp.fw.web.util.WebParameter;

public class BusinessC implements Business<WebParameter> {

	@Override
	public int doExecute(WebParameter parameter) {
		Logger log = parameter.getLog();
		log.info(this.getClass().getSimpleName());

		SqlSession sqlSession = parameter.getSqlSession();
		Pet newPet = new Pet();
		newPet.setPetId(10);
		newPet.setPetName("エラー");
		newPet.setOwnerName("エラー太郎");
		newPet.setPrice(3000);
		newPet.setBirthDate(new Date());
		sqlSession.insert("com.xxxxxxx.drvpp.biz.web.xyz.dao.PetMapper.insertPet", newPet);
		
		parameter.setViewName("controller");
		
		//throw new Exception();
		return 999;
	}
}
