/** Allocate the property to a list. */
  private void allocateToList(BeanProperty prop) {
    if (prop.isTransient()) {
      transients.add(prop);
      if (prop.isDraft()) {
        draft = prop;
      }
      return;
    }
    if (prop.isId()) {
      ids.add(prop);
      return;
    } else {
      nonTransients.add(prop);
    }

    if (prop.isMutableScalarType()) {
      mutable.add(prop);
    }

    if (desc.getInheritInfo() != null && prop.isLocal()) {
      local.add(prop);
    }

    if (prop instanceof BeanPropertyAssocMany<?>) {
      manys.add((BeanPropertyAssocMany<?>) prop);

    } else {
      nonManys.add(prop);
      if (prop instanceof BeanPropertyAssocOne<?>) {
        BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) prop;
        if (prop.isEmbedded()) {
          embedded.add(assocOne);
        } else {
          ones.add(assocOne);
          if (!assocOne.isOneToOneExported()) {
            onesImported.add(assocOne);
          }
        }
      } else {
        // its a "base" property...
        if (prop.isVersion()) {
          if (versionProperty == null) {
            versionProperty = prop;
          } else {
            logger.warn(
                "Multiple @Version properties - property "
                    + prop.getFullBeanName()
                    + " not treated as a version property");
          }
        } else if (prop.isDraftDirty()) {
          draftDirty = prop;
        }
        if (prop instanceof BeanPropertyCompound) {
          baseCompound.add((BeanPropertyCompound) prop);
        } else {
          baseScalar.add(prop);
        }
      }
    }
  }
  public void dmlBind(BindableRequest request, EntityBean bean) throws SQLException {

    EntityBean idValue = (EntityBean) embId.getValue(bean);

    for (int i = 0; i < props.length; i++) {

      Object value = props[i].getValue(idValue);
      request.bind(value, props[i], props[i].getDbColumn());
    }

    request.setIdValue(idValue);
  }
  private BeanPropertyAssocOne<?>[] getOne(boolean imported, Mode mode) {
    ArrayList<BeanPropertyAssocOne<?>> list = new ArrayList<BeanPropertyAssocOne<?>>();
    for (int i = 0; i < ones.size(); i++) {
      BeanPropertyAssocOne<?> prop = ones.get(i);
      if (imported != prop.isOneToOneExported()) {
        switch (mode) {
          case Save:
            if (prop.getCascadeInfo().isSave()) {
              list.add(prop);
            }
            break;
          case Delete:
            if (prop.getCascadeInfo().isDelete()) {
              list.add(prop);
            }
            break;
          default:
            break;
        }
      }
    }

    return (BeanPropertyAssocOne[]) list.toArray(new BeanPropertyAssocOne[list.size()]);
  }
  public boolean deriveConcatenatedId(PersistRequestBean<?> persist) {

    if (matches == null) {
      String m =
          "Matches for the concatinated key columns where not found?"
              + " I expect that the concatinated key was null, and this bean does"
              + " not have ManyToOne assoc beans matching the primary key columns?";
      throw new PersistenceException(m);
    }

    EntityBean bean = persist.getEntityBean();

    // create the new id
    EntityBean newId = (EntityBean) embId.createEmbeddedId();

    // populate it from the assoc one id values...
    for (int i = 0; i < matches.length; i++) {
      matches[i].populate(bean, newId);
    }

    // support PropertyChangeSupport
    embId.setValueIntercept(bean, newId);
    return true;
  }
 public BindableIdEmbedded(BeanPropertyAssocOne<?> embId, BeanDescriptor<?> desc) {
   this.embId = embId;
   this.props = embId.getProperties();
   matches = MatchedImportedProperty.build(props, desc);
 }