Пример #1
0
 private static void setParameter(SQLQuery sqlQuery, Object... params) {
   if (Validator.isNotEmpty(params)) {
     for (int i = 0; i < params.length; i++) {
       sqlQuery.setParameter(i, params[i]);
     }
   }
 }
Пример #2
0
 /**
  * 判断数据库表是否存在(只适用于DB2)
  *
  * @param schema
  * @param tableName
  * @return true:存在;false:不存在
  * @author LiuKun
  * @throws SQLException
  * @created 2012-8-9 下午7:29:24
  */
 @Transactional
 public Boolean existTableForDB2(String schema, String tableName) {
   if (Validator.isEmpty(schema)) {
     throw new RuntimeException("schema为空!");
   }
   if (Validator.isEmpty(tableName)) {
     throw new RuntimeException("tableName为空!");
   }
   String sql = " SELECT NAME FROM SYSIBM.SYSTABLES WHERE CREATOR = ? AND NAME = ?  ";
   List<Map<String, Object>> mapList =
       executeQuery(sql, null, schema.toUpperCase(), tableName.toUpperCase());
   if (Validator.isNotEmpty(mapList)) {
     return Boolean.TRUE;
   } else {
     return Boolean.FALSE;
   }
 }
Пример #3
0
 /**
  * 保存实体集合
  *
  * @param entitys
  * @author LiuKun
  * @created 2012-8-2 上午9:56:27
  */
 @Transactional
 public <E extends Entity> void save(Collection<E> entitys) {
   if (Validator.isNotEmpty(entitys)) {
     baseDao.save(entitys);
   }
 }