Class Expressions

java.lang.Object
org.springframework.data.jpa.criteria.Expressions

public abstract class Expressions extends Object
Utility methods to resolve JPA Criteria API objects using Spring Data's type-safe property references. These helper methods obtain Criteria API objects using TypedPropertyPath and PropertyReference to resolve property expressions and joins.

The class is intended for concise, type-aware criteria construction through a type-safe DSL where property references are preferred over string-based navigation.

Example:

 Root<User> root = criteriaQuery.from(User.class);

 Expression<User> expr = Expressions.get(root, User::getManager);

 Join<User, Address> join = Expressions.join(root, JoinType.INNER, j -> j.join(User::getAddress));
 
Since:
4.1
Author:
Mark Paluch
See Also: