You cannot use LIKE
operator for DATE
AND DATETIME
data type.
There are some function for date, month, year, etc. Most of the Persistence Provider
supported.
FUNC('MONTH', date)
FUNC('YEAR', date)
For eclipselink
select object(o) from Orders as o WHERE FUNC('YEAR', o.orderDate) = :def
Parameter
q.setParameter("def", def);