Esempio n. 1
0
  public OfferUser getOfferUser(int offerId, int userId) throws InvocationTargetException {
    String sql =
        "select offer_id as offerId, USER_ID as userId,status from offer_user "
            + " where offer_id = ? and USER_ID= ?";
    OfferUser offerUser = null;
    try {
      this.pstmt = JDBCDataConnection.getConnection().prepareStatement(sql);
      this.pstmt.setInt(1, offerId);
      this.pstmt.setInt(2, userId);
      ResultSet rs = this.pstmt.executeQuery();

      Object[] obj =
          ResultSetToModel.parseDataEntityBeans(rs, "com.offerme.server.database.model.OfferUser");
      if (obj.length > 0) {
        offerUser = (OfferUser) obj[0];
      }

    } catch (Exception e) {

      String err = Log.getStackInfo(e);
      myLog.error(err);
      throw new InvocationTargetException(e, err);
    } finally {
      this.free();
    }

    return offerUser;
  }