Example usage for org.apache.ibatis.session SqlSession selectOne

List of usage examples for org.apache.ibatis.session SqlSession selectOne

Introduction

In this page you can find the example usage for org.apache.ibatis.session SqlSession selectOne.

Prototype

<T> T selectOne(String statement, Object parameter);

Source Link

Document

Retrieve a single row mapped from the statement key and parameter.

Usage

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public String getNombreExpediente(String codigo, String tipo) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("codigo", codigo);
    map.put("tipo", tipo);

    String nombreexp = "";
    SqlSession session = sqlSessionFactory.openSession();
    try {/*from   w ww .ja  v  a2  s. c o  m*/
        nombreexp = session.selectOne("RegistroInversion.getNumeroExp", map);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        System.out.println("ERROR EN EL IMPL getnumonto");
    } finally {
        session.close();
    }
    return nombreexp;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public String getNombreDocumentos(String codigo, String tipo, String exp) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("codigo", codigo);
    map.put("tipo", tipo);
    map.put("numeroExp", exp);

    String nombreexp = "";
    SqlSession session = sqlSessionFactory.openSession();
    try {/*  w w  w.j  a va  2  s .c o  m*/
        nombreexp = session.selectOne("RegistroInversion.getNumeroDocumento", map);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        System.out.println("ERROR EN EL IMPL getnumonto");
    } finally {
        session.close();
    }
    System.out.println(nombreexp);
    return nombreexp;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Integer getIdProyExpt2(Integer numero, Integer idproy, Integer etapa) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("numero", String.valueOf(numero));
    map.put("idproy", String.valueOf(idproy));
    map.put("etapa", String.valueOf(etapa));
    Integer idproyexpt = null;/* www  .  j  a va2  s .c  o  m*/
    SqlSession session = sqlSessionFactory.openSession();
    try {
        idproyexpt = session.selectOne("RegistroInversion.getIdProyectoExpt", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdProyectoExpt");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(idproyexpt);
    return idproyexpt;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

public Integer getIdNuevoDocu(Integer numerodocu, String exptecn, Integer tipodocu) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("numerodocu", String.valueOf(numerodocu));
    map.put("exptecn", exptecn);
    map.put("tipodocu", String.valueOf(tipodocu));
    SqlSession session = sqlSessionFactory.openSession();
    Integer idproyextp = null;//from www . ja v  a 2  s.  co m
    try {
        idproyextp = session.selectOne("RegistroInversion.getIdNuevosDocus2", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdNuevosDocus2");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(idproyextp);
    return idproyextp;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Componentes getMontosPorEtapa(String codigo, String etapa) {
    Componentes busq = null;/*from  w  ww .j a v a 2  s . co  m*/
    Map<String, String> map = new HashMap<String, String>();
    map.put("codigo", codigo);
    map.put("etapa", etapa);
    SqlSession session = sqlSessionFactory.openSession();
    try {
        busq = session.selectOne("RegistroInversion.getMontosPorEtapa", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getMontosPorEtapa");
        System.out.println(e.getMessage());
        e.printStackTrace();
    } finally {
        session.close();
    }
    return busq;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

public Integer getIdNuevosDocus(String nombre, String idproy, String c) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("idproy", String.valueOf(idproy));
    map.put("numerocontrato", String.valueOf(nombre));
    map.put("idexpt", c);

    Integer idproyexpt = null;//from   w w w . j a  v  a  2s  .  c  o m
    SqlSession session = sqlSessionFactory.openSession();
    try {
        idproyexpt = session.selectOne("RegistroInversion.getIdNuevosDocus", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdNuevosDocus");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(idproyexpt);
    return idproyexpt;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Componentes getExpediente0(String proyecto) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("proyecto", proyecto);
    Componentes cantidad = null;/*from  w  ww.ja v a2  s . c  o  m*/
    SqlSession session = sqlSessionFactory.openSession();
    try {
        cantidad = session.selectOne("RegistroInversion.getMontosExp0", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdNuevosDocus");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(cantidad);
    return cantidad;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Integer getCantidadExpTecn(String proyecto) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("proyecto", proyecto);
    System.out.println("Proyecto: " + proyecto);
    Integer cantidad = null;// ww w.j a v a2 s .c om
    SqlSession session = sqlSessionFactory.openSession();
    try {
        cantidad = session.selectOne("RegistroInversion.cantiExpTecn", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdNuevosDocus");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(cantidad);
    return cantidad;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Integer getMaxNumMontoHistorial(String codproy, String expTecn) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("codProy", codproy);
    map.put("expTecn", expTecn);
    Integer idhistorial = null;//w  ww .j  av  a2 s  .c  om
    SqlSession session = sqlSessionFactory.openSession();
    try {
        idhistorial = session.selectOne("RegistroInversion.getIdHistorial", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getIdNuevosDocus");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    System.out.println(idhistorial);
    return idhistorial;
}

From source file:gp.daoImpl.RegistroInversionDaoImpl.java

@Override
public Integer getNumeroEjecu(String codProy, String anio) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("codProy", codProy);
    map.put("anio", anio);
    System.out.println("Codigo: " + codProy + " Anio: " + anio);
    Integer numEjecu = null;//from   w  ww .ja  va 2  s. com
    SqlSession session = sqlSessionFactory.openSession();
    try {
        numEjecu = session.selectOne("RegistroInversion.numEjecu", map);
    } catch (Exception e) {
        System.out.println("ERROR EN EL IMPL getNumeroEjecu");
        System.out.println(e.getMessage());

        e.printStackTrace();
    } finally {
        session.close();
    }
    if (numEjecu == null) {
        numEjecu = 0;
    }
    numEjecu = numEjecu + 1;
    System.out.println("Nmero: " + numEjecu);
    return numEjecu;
}