Package net.hasor.db.jdbc.core

Examples of net.hasor.db.jdbc.core.JdbcTemplate.queryForList()


        AppContext app = Hasor.createAppContext("net/test/simple/db/jdbc-config.xml", new OneDataSourceWarp());
        JdbcTemplate jdbc = app.getInstance(JdbcTemplate.class);
        //
        Map<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("id", "76%");
        List<Map<String, Object>> userList = jdbc.queryForList("select * from TB_User where userUUID like :id", paramMap);
        HasorUnit.printMapList(userList);
    }
}
View Full Code Here


        System.out.println("--->>entity_QueryTest<<--");
        //
        AppContext app = Hasor.createAppContext("net/test/simple/db/jdbc-config.xml", new OneDataSourceWarp());
        JdbcTemplate jdbc = app.getInstance(JdbcTemplate.class);
        //
        List<TB_User> userList = jdbc.queryForList("select * from TB_User", TB_User.class);
        HasorUnit.printObjectList(userList);
    }
}
View Full Code Here

        System.out.println("--->>simpleParam_QueryTest<<--");
        //
        AppContext app = Hasor.createAppContext("net/test/simple/db/jdbc-config.xml", new OneDataSourceWarp());
        JdbcTemplate jdbc = app.getInstance(JdbcTemplate.class);
        //
        List<Map<String, Object>> userList = jdbc.queryForList("select * from TB_User where userUUID like ?", "76%");
        HasorUnit.printMapList(userList);
    }
}
View Full Code Here

            batchValues[i].put("Pwd", String.format("pwd_%s", i));
            batchValues[i].put("Email", String.format("autoUser_%s@hasor.net", i));
            batchValues[i].put("RegTime", new Date());
        }
        jdbc.batchUpdate(batchInsert, batchValues);//批量执行执行插入语句
        HasorUnit.printMapList(jdbc.queryForList("select * from TB_User"));
        //
        showUserCount(jdbc);//显示当前用户总数
    }
    private void showUserCount(JdbcTemplate jdbc) throws SQLException {
        System.out.println(">>>>>  userCount :" + jdbc.queryForInt("select count(*) from TB_User"));
View Full Code Here

        while (true) {
            String selectSQL = "select * from " + tableName;
            String selectCountSQL = "select count(*) from " + tableName;
            //
            JdbcTemplate jdbc = new JdbcTemplate(conn);
            List<Map<String, Object>> dataList = jdbc.queryForList(selectSQL);
            int rowCount = jdbc.queryForInt(selectCountSQL);
            String logData = HasorUnit.printMapList(dataList, false);
            String localHashValue = CommonCodeUtils.MD5.getMD5(logData);
            if (!StringUtils.equals(hashValue, localHashValue)) {
                System.out.println(String.format("watch : -->Table ‘%s’ rowCount = %s.", tableName, rowCount));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.