Projects‎ > ‎

Empty vs Null Attributes


Applications (clients) need to "remove" / "clear" / "unset" / "deselect" the value(s) of an attribute. Throughout this document the term "remove" will be used identify this process. The conditions for "removing" a value will be from the client/framework perspective. Each Service/Operation will need to properly interpret the "remove" condition and perform (as needed) repository specific tasks. This process applies only to Attributes that are of type String.


It is assumed that an UPDATE Operation will ONLY contain the Attributes that need to be changed. The Input will NOT contain Attribute(s) (and values) that already exist and are not different from the Attribute(s) (and values) already in the Service repository. The UPDATE will ONLY contain "deltas", not all of the Attributes for the entry.


The solution involves enhancements to the Framework Tier and Service/Operation Tier. An Attribute will be "removed" from the Subject under these conditions:

  1. The Operation is UPDATE
  2. The Input contains the Attribute (that needs to be "removed")
  3. The Attribute is not required, as declared in the Definition
  4. The Attribute value is either:
    • NULL
    • non-NULL with a zero length

If the above "conditions" are true, for an UPDATE, the Service/Operation will receive an Attribute with an empty value (non-null). The Service may be capable of "processing" this "remove" one of the following ways:

  1. Store an empty value (non-null), for the Attribute, in its repository (default)
  2. Remove the Attribute from its repository
    • For RDBMS, may be implemented as setting the column (for the record) to NULL
    • For LDAP, may be implemented by removing the attribute from the entry


The Services need to be enhanced to support the "removing" of an Attribute. A Property called attribute.empty.remove will be used by the Connection / Context.

  • If the Property is equal to true and all the "conditions" are true (see Architecture)
    • The Service/Operation will remove the Attribute (assuming it is capable of actual "removal")
  • Else (default)
    • The Service/Operation will set the Attribute value to be an empty String


  • Operation: UPDATE
  • If the value for the String attribute is null, set it to an empty String (zero length)
  • If the Property (set on the Connection) attribute.empty.remove equals true and value.length() equals zero
    • The JDBC ((preparedStatement}} will use null with the setString() method
  • Else
    • The JDBC preparedStatement will use null with the setString() method


JNDI (OpenDS) does not allow an attribute to have an "empty" value. If the attribute has no value, it must be removed from the entry.

  • Operation: UPDATE
  • Create a JNDI BasicAttribute instance
  • Only use the add() method if the value is NOT null AND has a length greater than zero
  • The _ldapCtx.modifyAttributes() method will actually "remove" an attribute that has no values