Reputation: 5572
JPQL has entity type expression, e.g.
SELECT e
FROM Employee e
WHERE TYPE(e) IN (Exempt, Contractor)
Does criteria API have entity type expression?
Upvotes: 0
Views: 331
Reputation: 10716
Yes. Path.type()
creates an Expression
corresponding to the type of the given path. You can then create class literals using CriteriaBuilder.literal()
for use in comparison expressions.
Upvotes: 1