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:fr.cph.stock.dao.ShareValueDaoImpl.java

License:Apache License

@Override
public final ShareValue select(final int id) {
    SqlSession session = getSqlSessionFactory();
    ShareValue shareValue = null;//from  ww  w.  ja  v a 2 s  .  c om
    try {
        shareValue = session.selectOne("ShareValue.selectOneShareValue", id);
    } finally {
        session.close();
    }
    return shareValue;
}

From source file:fr.cph.stock.dao.ShareValueDaoImpl.java

License:Apache License

/**
 * Get the last share value of a user/*w w w .  jav  a  2  s  .  c  o  m*/
 * 
 * @param userId
 *            the user id
 * @return a share value
 */
public final ShareValue selectLastValue(final int userId) {
    SqlSession session = getSqlSessionFactory();
    ShareValue shareValue = null;
    try {
        shareValue = session.selectOne("ShareValue.selectLastValue", userId);
    } finally {
        session.close();
    }
    return shareValue;
}

From source file:fr.cph.stock.dao.UserDaoImpl.java

License:Apache License

@Override
public final User select(final int id) {
    SqlSession session = getSqlSessionFactory();
    User userResult = null;//w  w  w . ja va2s. c  o m
    try {
        userResult = session.selectOne("UserDao.selectOneUser", id);
    } finally {
        session.close();
    }
    return userResult;
}

From source file:fr.cph.stock.dao.UserDaoImpl.java

License:Apache License

/**
 * Get a user with its login/*from  w ww. j  av a 2  s .c o m*/
 * 
 * @param login
 *            the login
 * @return a user
 */
public final User selectWithLogin(final String login) {
    SqlSession session = getSqlSessionFactory();
    User userResult = null;
    try {
        userResult = session.selectOne("UserDao.selectOneUserWithLogin", login);
    } finally {
        session.close();
    }
    return userResult;
}

From source file:fr.cph.stock.dao.UserDaoImpl.java

License:Apache License

/**
 * Get a user with its email// w ww. j  av  a 2  s. co  m
 * 
 * @param email
 *            the email
 * @return a user
 */
public final User selectWithEmail(final String email) {
    SqlSession session = getSqlSessionFactory();
    User userResult = null;
    try {
        userResult = session.selectOne("UserDao.selectOneUserWithEmail", email);
    } finally {
        session.close();
    }
    return userResult;
}

From source file:gp.daoImpl.BusqPreInversionDaoImpl.java

@Override
public String validarProyecto(String codigo) {
    String nombreexp = null;//from  www. j  av  a 2  s.  c om
    SqlSession session = sqlSessionFactory.openSession();
    try {
        nombreexp = session.selectOne("BusqPreInversion.validarProy", codigo);
    } 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.BusquedaInversionDaoImpl.java

@Override
public Integer getIdProyExpt(String docu) {
    Integer inte = null;//  w w  w.  ja  v  a  2  s  .c  o  m
    SqlSession session = sqlSessionFactory.openSession();
    try {
        inte = session.selectOne("BusquedaInversion.getIdExpTecn", docu);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    } finally {
        session.close();
    }
    return inte;
}

From source file:gp.daoImpl.BusquedaInversionDaoImpl.java

@Override
public String getNombreProy(String codigo) {
    SqlSession session = sqlSessionFactory.openSession();
    String list = null;// www.  ja va  2 s  .co  m
    try {
        list = session.selectOne("BusquedaInversion.getProy", codigo);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    } finally {
        session.close();
    }
    return list;
}

From source file:gp.daoImpl.gestionUsuarioDaoImpl.java

@Override
public Integer getTipoUsuario(String nombre) {
    Integer inte = null;/*from  w w  w  .  j  a v a2 s .c  o  m*/
    SqlSession session = sqlSessionFactory.openSession();
    try {
        inte = session.selectOne("UsuarioData.getIdTipoUsuario", nombre);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    } finally {
        session.close();
    }
    return inte;
}

From source file:gp.daoImpl.ListasGeneralesDaoImpl.java

@Override
public HistorialMontos getMontoViable(String codigo) {
    SqlSession session = sqlSessionFactory.openSession();
    HistorialMontos h = null;//from ww w.j  a va2s  .c  o m
    try {
        h = session.selectOne("ListasGenerales.getMontoViable", codigo);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        System.out.println("ERROR EN EL GET USU");
    } finally {
        session.close();
    }
    return h;
}