Example usage for org.apache.ibatis.jdbc SqlRunner selectOne

List of usage examples for org.apache.ibatis.jdbc SqlRunner selectOne

Introduction

In this page you can find the example usage for org.apache.ibatis.jdbc SqlRunner selectOne.

Prototype

public Map<String, Object> selectOne(String sql, Object... args) throws SQLException 

Source Link

Document

Executes a SELECT statement that returns one row.

Usage

From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java

License:Apache License

@Test
public void testSelectOne() {
    Connection connection = null;
    SqlRunner runner = null;
    try {//w  w w. ja va2  s .c o m
        connection = DBConnectionFactory.getConnection();
        runner = new SqlRunner(connection);
        Object args = "res_system_name";
        Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args);
        System.out.println(dataMap);
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        JdbcUtils.close(connection);
    }
}

From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java

License:Apache License

@Test
public void testSelectOne2() {
    Connection connection = null;
    SqlRunner runner = null;
    try {/* w w  w. j a  v  a2s  .com*/
        connection = DBConnectionFactory.getConnection("wechat");
        runner = new SqlRunner(connection);
        Object args = "res_system_name";
        Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args);
        System.out.println(dataMap);
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        JdbcUtils.close(connection);
    }
}

From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java

License:Apache License

@Test
public void testSelectOne3() {
    Connection connection = null;
    SqlRunner runner = null;
    try {/* w w  w  . j  a  va 2 s.c om*/
        connection = DBConnectionFactory.getConnection("yz");
        runner = new SqlRunner(connection);
        Object args = "res_system_name";
        Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args);
        System.out.println(dataMap);
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        JdbcUtils.close(connection);
    }
}

From source file:com.glaf.core.test.MyBatisTest.java

License:Apache License

@Test
public void testSqlRunnerSelectOne() {
    SqlRunner runner = null;
    java.sql.Connection conn = null;
    try {/*from   ww  w .  j a v  a2  s .co  m*/
        conn = DBConnectionFactory.getConnection();
        runner = new SqlRunner(conn);
        Map<String, Object> row = runner.selectOne("select * from sys_dbid where NAME_ = ? ", "next.dbid");
        System.out.println("One#######:" + row);
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        JdbcUtils.close(conn);
    }
}