⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wbemployee_ji9hxe__weblogic_cmp_rdbms_wbrole_set.java

📁 客户管理系统,很强大的功能,能完成日常生活中的大部分事务
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
      }
      return true;
    } catch (java.sql.SQLException se) {
      if(__WL_verbose) {
        Debug.say("WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.addJoinTable() "+
           "checking for duplicate key " + __WL_con);
      }
      try {
        boolean exists = existsJoinTable(__WL_pk1, __WL_pk2);
        if (exists) return false;
        throw se;
      } catch (Exception ex) {
        if (__WL_verbose) {
          Debug.say("Exception during existsJoinTable is being ignored.");
          ex.printStackTrace();
        }
        throw se;
      }
    } finally {
      __WL_pm.releaseResources(__WL_con, __WL_stmt, null);
    }
  }

  public String getAddJoinTableSQL()
  {
    return "INSERT INTO Wb_Employee_Role (employee_uid, role_uid) VALUES (?, ?)";
  }

  public void setAddJoinTableSQLParams(java.sql.PreparedStatement __WL_stmt,
                                       Object                     __WL_pk1,
                                       Object                     __WL_pk2)
    throws java.sql.SQLException
  {
    __WL_stmt.setLong(1, ((java.lang.Long)__WL_pk1).longValue());
__WL_stmt.setLong(2, ((java.lang.Long)__WL_pk2).longValue());

  }


  public Transaction getTransaction() { return __WL_createTx; }
 
  public void setTransaction(Transaction newCreateTx) { 
    __WL_createTx = newCreateTx;  
  }

  public boolean add(Object o)
  {
    if (__WL_verbose) Debug.say("add() called.");

    checkTransaction();

    if (o==null)
      throw new IllegalArgumentException();

    if (!(o instanceof custom_management.WbRole))
      throw new IllegalArgumentException(
        "Attempted to add an object of type '" +
        o.getClass().getName() +
        "' to collection, but the type must be '" +
        "custom_management.WbRole' instead.");

    try {
      EJBLocalObject eo = (EJBLocalObject)o;
      custom_management.WbRole_wjvqb2_Intf __WL_bean = (custom_management.WbRole_wjvqb2_Intf)
        __WL_bm.lookup(eo.getPrimaryKey());

      try {
        __WL_bean.__WL_checkExistsOnMethod();
      }
      catch (NoSuchEntityException nsee) {
        throw new IllegalArgumentException(
          "Instance of EJB 'WbRole' with primary key '" + 
          eo.getPrimaryKey() +
          "' does not exist.");
      }

      boolean changed = false;
      Object  otherPK = null;

      if (orderDatabaseOperations) {
        
      // do add check for deferred Join Table INSERTs

      otherPK = eo.getPrimaryKey();
      boolean contains = getAddSet().contains(otherPK);
      if (contains) {
        if (__WL_verbose)
          Debug.say("WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set: add: skipping JoinTable check, "+
                    "addSet already contains cached Join Table INSERT pk '"+otherPK+"'");

        return false;       // this PK already added, exit false
      }

      boolean exists = false;
      exists = existsJoinTable(__WL_createPk, eo.getPrimaryKey());
      if (exists) {
        return false;       // this PK already in Join Table, exit false
      }
      changed = (!exists);

      }
      else {
        
      // do add check for non-deferred Join Table INSERTs

      changed = addJoinTable(__WL_createPk, eo.getPrimaryKey());
      if (__WL_symmetric) {
        if (!__WL_createPk.equals(eo.getPrimaryKey())) {
          addJoinTable(eo.getPrimaryKey(), __WL_createPk);
        }
      }

      }

      if (changed) {
        if (orderDatabaseOperations) {

          // add to Bulk Add Set          
          if (__WL_verbose) {
            Debug.say("adding pk '"+otherPK+"' to addSet");
          }
          addToAddSet(otherPK);
        }

        doAdd(eo);

        int oldState = __WL_bean.__WL_getMethodState();
        try {
          __WL_bean.__WL_setMethodState(WLEnterpriseBean.STATE_BUSINESS_METHOD);
          RDBMSM2NSet __WL_collection = (RDBMSM2NSet)
            __WL_bean.getWbEmployee();
          __WL_collection.doAdd(__WL_createEo);

          if (orderDatabaseOperations) {

            // add the PK of this side of M-N relation to the
            // deferred addSet of the other side of the M-N relation.

            __WL_collection.addToAddSet(__WL_createPk);
          }

        } finally {
          __WL_bean.__WL_setMethodState(oldState);
        }
      }
      return changed;
    } catch (RuntimeException re) {
      if (__WL_verbose) {
        Debug.say("rethrowing RuntimeException.");
        re.printStackTrace();
      }
      throw re;
    } catch (Exception ex) {
      if (__WL_verbose) {
        Debug.say("wrapping Exception in PersistenceRuntimeException.");
        ex.printStackTrace();
      }
      throw new PersistenceRuntimeException(ex);
    }

  }


  public boolean addAll(Collection __WL_collection) {
    if (__WL_verbose) Debug.say("addAll() called.");

    checkTransaction();

    if (__WL_collection==null) return false;
    Iterator __WL_iter = __WL_collection.iterator();

    boolean changed = false;
    while (__WL_iter.hasNext()) {
      changed |= add(__WL_iter.next());
    }
    return changed;
  }


    public void addToAddSet(Object pk)

  {
    if (__WL_verbose)
      Debug.say("WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set: addToAddSet:  creator pk '"+__WL_createPk+
                "' adding to cached Join Table Insert pk '"+pk+"'");

    getAddSet().add(pk);

    __WL_pm.registerM2NJoinTableInsert("wbRole", __WL_createPk);
    
  }


  public void clear() {
    if (__WL_verbose) Debug.say("clear() called.");

    checkTransaction();

    if (__WL_cache==null) {
      populateCache();
    }

    Collection cln = (Collection)((HashSet)__WL_cache).clone();
    Iterator __WL_iter = cln.iterator();
    while (__WL_iter.hasNext()) {
      EloWrapper __WL_wrapper = (EloWrapper)__WL_iter.next();

      remove(__WL_wrapper.getEJBLocalObject());
    }
  }


  public boolean contains(Object o)
  {
    if (__WL_verbose) Debug.say("contains() called.");

    checkTransaction();

    if (o==null) throw new IllegalArgumentException();

    try {
      EJBLocalObject eo = (EJBLocalObject)o;
      custom_management.WbRole_wjvqb2_Intf __WL_bean = (custom_management.WbRole_wjvqb2_Intf)
        __WL_bm.lookup(eo.getPrimaryKey());

      try {
        __WL_bean.__WL_checkExistsOnMethod();
      }
      catch (NoSuchEntityException nsee) {
        Loggable l = EJBLogger.logbeanDoesNotExistLoggable("WbRole",eo.getPrimaryKey().toString());
        throw new IllegalArgumentException(l.getMessage());         
      }

      if (__WL_cache !=null) {
        EloWrapper wrap = new EloWrapper(eo);

        return __WL_cache.contains(wrap);
      }

      // we may have a deferred the INSERT of this bean
      if (orderDatabaseOperations) {
        if (getAddSet().contains(eo.getPrimaryKey())) {
          return true;
        }
      }
      return existsJoinTable(__WL_createPk, eo.getPrimaryKey());
    } catch (RuntimeException re) {
      if (__WL_verbose) {
        Debug.say("rethrowing RuntimeException.");
        re.printStackTrace();
      }
      throw re;
    } catch (Exception ex) {
      if (__WL_verbose) {
        Debug.say("wrapping Exception in PersistenceRuntimeException.");
        ex.printStackTrace();
      }
      throw new PersistenceRuntimeException(ex);
    }

  }


  public boolean containsAll(Collection eos)
  {
    if (__WL_verbose) Debug.say("containsAll() called.");

    checkTransaction();

    if (eos==null) return true;

    Iterator iter = eos.iterator();
    while (iter.hasNext()) {
      if (!contains(iter.next())) {
        return false;
      }
    }

    return true;
  }


  public boolean equals(Object o)
  {
    if (__WL_verbose) Debug.say("equals() called.");

    checkTransaction();

    if (!(o instanceof WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set))
      return false;

    WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set other = (WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set)o;

    if (__WL_cache==null)
      populateCache();
    if (other.__WL_cache==null)
      other.populateCache();

    return __WL_cache.equals(other.__WL_cache);
  }


  public int hashCode()
  {
    if (__WL_verbose) Debug.say("hashCode() called.");

    checkTransaction();

    if (__WL_cache==null)
      populateCache();

    return __WL_cache.hashCode();
  }


  public boolean isEmpty()
  {
    if (__WL_verbose) Debug.say("isEmpty() called.");

    checkTransaction();

    if (__WL_cache==null)
      populateCache();

    return __WL_cache.isEmpty();
  }


  private boolean removeJoinTable(Object __WL_pk1, Object __WL_pk2)
  {
    if (__WL_verbose) Debug.say("removeJoinTable() called.");

    java.sql.Connection __WL_con = null;
    java.sql.PreparedStatement __WL_stmt = null;
    try {
      __WL_con = __WL_pm.getConnection();
      String __WL_query = "delete from Wb_Employee_Role where (employee_uid = ?) AND (role_uid = ?)";
      if (__WL_verbose) {
        Debug.say("WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.removeJoinTable() " +
          "produced sqlString: " + __WL_query);
      }
      __WL_stmt = __WL_con.prepareStatement(__WL_query);

      __WL_stmt.setLong(1, ((java.lang.Long)__WL_pk1).longValue());
__WL_stmt.setLong(2, ((java.lang.Long)__WL_pk2).longValue());


      if (__WL_stmt.executeUpdate() != 1) {
        return false;
      }
      else {
        return true;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -