コード例 #1
0
 public GenericVO findByPK(GenericVO vo) throws AppException, SysException {
   StaffWorkAreaSVO result = null;
   StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo;
   StringBuffer sql = new StringBuffer("select");
   sql.append(
       " a.STAFF_WORK_AREA_ID,a.STAFF_ID,a.WORK_AREA_ID,a.GRANTOR,a.ADMIN_FLAG,a.STS,a.STS_DATE,a.CREATE_DATE");
   sql.append(" from STAFF_WORK_AREA a where 1=1");
   sql.append(" and STAFF_WORK_AREA_ID=?");
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     ps.setString(1, staffWorkArea.getStaffWorkAreaId());
     rs = ps.executeQuery();
     result = (StaffWorkAreaSVO) ResultSetUtil.convertToVo(rs, StaffWorkAreaSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByPK error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return result;
 }
コード例 #2
0
 public GenericVO findByPK(GenericVO vo) throws AppException, SysException {
   ProvinceSVO result = null;
   ProvinceSVO province = (ProvinceSVO) vo;
   StringBuffer sql = new StringBuffer("select");
   sql.append(" a.PROV_ID,a.NAME");
   sql.append(" from PROVINCE a where 1=1");
   sql.append(" and PROV_ID=?");
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     ps.setString(1, province.getProvId());
     rs = ps.executeQuery();
     result = (ProvinceSVO) ResultSetUtil.convertToVo(rs, ProvinceSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByPK error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return result;
 }