コード例 #1
0
  /**
   * Return Order statuses of Reports
   *
   * @ejb.interface-method
   * @ejb.transaction type="Supports"
   */
  public List findOrderStates() throws LocalException {

    OrderStatesValue object = null;

    String sql =
        "select ID,ORDER_STATES,ICC_OR_UP_ISENABLED,MNR_ISENABLED from Order_States_For_Reports";
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet result = null;
    List l = new ArrayList();
    try {
      con = getConnection();
      ps = con.prepareStatement(sql);
      result = ps.executeQuery();
      while (result.next()) {
        object = new OrderStatesValue();
        object.setId(result.getInt(1));
        object.setOrder_states((result.getString(2)));
        object.setIcc_or_up_iseditable(result.getBoolean(3));
        object.setMnr_iseditable((result.getBoolean(4)));
        l.add(object);
      }

    } catch (Exception e) {
      // getLog().warn("####EX:" + e.getMessage());
      throw new LocalException(e);

    } finally {
      closeQuietly(result, ps, con);
    }
    return l;
  }
コード例 #2
0
  /**
   * @ejb.interface-method
   * @ejb.transaction type="Supports"
   */
  public OrderStatesValue findByPrimaryKey(PrimaryKey primaryKey) throws LocalException {
    OrderStatesPK opk = (OrderStatesPK) primaryKey;

    int id = opk.getId();
    OrderStatesValue object = null;

    String sql =
        "select ID,ORDER_STATES,ICC_OR_UP_ISENABLED,MNR_ISENABLED from Order_States_For_Reports where ID=? ";
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet result = null;

    try {
      con = getConnection();
      ps = con.prepareStatement(sql);
      ps.setInt(1, id);
      result = ps.executeQuery();
      if (result.next()) {
        object = new OrderStatesValue();
        object.setId(result.getInt(1));
        object.setOrder_states(result.getString(2));
        object.setIcc_or_up_iseditable(result.getBoolean(3));
        object.setMnr_iseditable(result.getBoolean(4));
      }

    } catch (Exception e) {
      // getLog().warn("####EX:" + e.getMessage());
      throw new LocalException(e);

    } finally {
      closeQuietly(result, ps, con);
    }
    return object;
  }