Criteria API and Metamodel

Several OpenJPA extensions and lenient behaviors of the Criteria API were tightened to the specification: CriteriaBuilder.array()/tuple() reject nested compound selections and multiselect()/select() reject duplicate aliases with IllegalArgumentException; cb.literal(null) throws IllegalArgumentException (use nullLiteral(Class)); Path.get() on a basic path and From.getCorrelationParent() on a non-correlated From throw IllegalStateException; Metamodel.entity(Class)/embeddable(Class) throw IllegalArgumentException for unknown types instead of returning null; ParameterExpression.getPosition() returns null (previously threw an internal exception).

Embeddable-typed attributes are no longer reported as associations (isAssociation() is false, getBindableType() is SINGULAR_ATTRIBUTE), getBindableJavaType() returns the declared attribute type, and getId(Class)/getDeclaredId(Class) require strict type assignability. cb.treat(Root, Class) is now implemented; treat() on joins and paths returns the argument unchanged without narrowing, and TREAT only matches the exact treated class, not its subclasses. Flatten nested selections, use unique aliases and adjust catch blocks and null checks accordingly.

Rejecting nested compound selections removes a documented OpenJPA extension that supported arbitrarily nested tuple and array selections. Applications relying on it can restore the previous behavior with the compatibility option AllowNestedCompoundSelection:

<property name="openjpa.Compatibility" value="AllowNestedCompoundSelection=true"/>