/** INTERNAL: Ensure that the descriptor has been set. */
  public void checkDescriptor(Object object, AbstractSession session) throws QueryException {
    if (this.descriptor == null) {
      if (object == null) {
        throw QueryException.objectToModifyNotSpecified(this);
      }

      // Bug#3947714  Pass the object instead of class in case object is proxy
      ClassDescriptor referenceDescriptor = session.getDescriptor(object);
      if (referenceDescriptor == null) {
        throw QueryException.descriptorIsMissing(object.getClass(), this);
      }
      setDescriptor(referenceDescriptor);
    }
  }