/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sikd.ikonsol.ejb.session;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import sikd.ikonsol.ejb.dao.TrialBalanceDao;
import sikd.ikonsol.model.TrialBalance;
import sikd.sikd5.sikd5ejb.session.util.MyBatisConnectionFactory;

/**
 *
 * @author riyan
 */
@Stateless
public class TrialBalanceEjbHomeImpl implements TrialBalanceEjbHome {
  private SqlSessionFactory sqlSessionFactory;
    private SqlSession session = null;

    private TrialBalanceDao dao;

    @PostConstruct
    public void init() {
        try {
            System.out.println("-------- Load MyBatis Factory IKonsol ------- ");
            sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactoryIkonsol();
            dao = new TrialBalanceDao(sqlSessionFactory);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    @Override
    public List<TrialBalance> findAll() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findAll();
    }

    @Override
    public TrialBalance findByID(int id) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findByID(id);
    }

    @Override
    public List<TrialBalance> findAllByTahunKode(int tahun, String kodePemda,int idbas,String kodePeriode) {
         return dao.findAllByTahunKode(tahun,kodePemda,idbas,kodePeriode);
    }

    @Override
    public List<TrialBalance> findAllByTahunKodeDetail(String kdrek1, int tahun, String kodePemda,int idbas,String kodePeriode) {
     //   throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findAllByTahunKodeDetail(kdrek1,tahun,kodePemda,idbas,kodePeriode);
     }

    @Override
    public List<TrialBalance> findAllByTahunKodeSum(int tahun, String kodePemda,int idbas,String kodePeriode) {
     return dao.findAllByTahunKodeSum(tahun,kodePemda,idbas,kodePeriode);
   }

        
    
    
}
