JPA Method
in jakarta.persistence.criteria.Expression

Expression<X> cast(
  Class<X> type
)


Cast this expression to the specified type, returning a new expression object. Unlike as(), this method does result in a runtime type conversion.

Providers are required to support casting scalar expressions to String, and String expressions to Integer, Long, Float, and Double. Support for typecasts between other basic types is not required.

Parameters:
type - a basic type
Return:
a scalar expression of the given basic type
Since:
JPA 3.2