package jp.agentec.sinaburocast.service;

import java.util.List;

import org.apache.poi.hssf.record.formula.functions.Sin;
import org.seasar.framework.container.annotation.tiger.Component;
import org.seasar.framework.container.annotation.tiger.InstanceType;

import jp.agentec.sinaburocast.entity.Constant;

@Component(instance=InstanceType.SINGLETON)
public class ConstantService extends AbstractService<Constant> {

	public static final String ID_SEQ_NAME = "constant_id_seq";

	/**
	 * IDを発行して、登録する。
	 */
	public int insertConstant(Constant constant, String insId) {
		constant.constantId = getSeqNextVal(Integer.class, ID_SEQ_NAME);
		return super.insert(constant, insId);
	}
	
	
    public Constant findById(Integer constantId) {
        return select().id(constantId).getSingleResult();
    }

    public List<Constant> findAllOrderById() {
        return select().orderBy("constantId asc").getResultList();
    }
}