This is not a bug. You are asking for a new feature. One that is specifically identified as undefined by the JPA spec. From section 3.8 Type Conversion of Basic Attributes:
he persistence provider must apply any conversion methods to instances of attribute values in path expressions used within Java Persistence query language queries or criteria queries (such as in comparisons, bulk updates, etc.) before sending them to the database for the query execution. When such converted attributes are used in comparison operations with literals or parameters, the value of the literal or parameter to which they are compared must also be converted. If the result of a Java Persistence query language query or criteria query includes one or more entity attributes for which conversion mappings have been specified, the persistence provider must apply the specified conversions to the corresponding values in the query result before returning them to the appli- cation. The use of functions, including aggregates, on converted attributes is undefined.
|