private final PO retrievePO(
      final Properties ctx,
      final String tableName,
      final String whereClause,
      final Object[] params,
      final String trxName) {
    if (whereClause == null || whereClause.length() == 0) {
      return null;
    }

    //
    PO po = null;
    final POInfo info = POInfo.getPOInfo(tableName);
    if (info == null) {
      return null;
    }

    final StringBuilder sqlBuffer = info.buildSelect();
    sqlBuffer.append(" WHERE ").append(whereClause);
    final String sql = sqlBuffer.toString();

    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, trxName);
      DB.setParameters(pstmt, params);

      rs = pstmt.executeQuery();
      if (rs.next()) {
        po = getPO(ctx, tableName, rs, trxName);
      }
    } catch (Exception e) {
      log.error(sql, e);
      MetasfreshLastError.saveError(log, "Error", e);
    } finally {
      DB.close(rs, pstmt);
    }

    return po;
  }
  /**
   * Loads the PO from database. In case some errors were encountered, they will be logged and
   * <code>null</code> will be returned.
   *
   * @param ctx
   * @param tableName
   * @param Record_ID
   * @param trxName
   * @return PO or null
   */
  private final PO retrievePO(
      final Properties ctx, final String tableName, int Record_ID, String trxName) {
    final POInfo poInfo = POInfo.getPOInfo(tableName);
    if (Record_ID > 0 && poInfo.getKeyColumnName() == null) {
      log.warn("(id) - Multi-Key " + tableName);
      return null;
    }

    final Class<?> clazz = tableModelClassLoader.getClass(tableName);
    if (clazz == null) {
      log.info("Using GenericPO for {}", tableName);
      final GenericPO po = new GenericPO(tableName, ctx, Record_ID, trxName);
      return po;
    }

    boolean errorLogged = false;
    try {
      final Constructor<?> constructor = tableModelClassLoader.getIDConstructor(clazz);
      final PO po = (PO) constructor.newInstance(ctx, Record_ID, trxName);
      if (po != null && po.get_ID() != Record_ID && Record_ID > 0) {
        return null;
      }
      return po;
    } catch (Exception e) {
      final Throwable cause = e.getCause() == null ? e : e.getCause();
      log.error("(id) - Table=" + tableName + ",Class=" + clazz, cause);
      MetasfreshLastError.saveError(log, "Error", cause);
      errorLogged = true;
    }

    if (!errorLogged) {
      log.error("(id) - Not found - Table=" + tableName + ", Record_ID=" + Record_ID);
    }

    return null;
  } // getPO