1
我的錯誤在哪裏?JPQL間隔日期
SELECT m FROM Message m WHERE m.tabId = :idTab AND BETWEEN :startDate AND :endDate ORDER BY m.id DESC
我有此錯誤:
Exception Description: Syntax error parsing the query ... , line 1, column 63: unexpected token [BETWEEN].
Internal Exception: NoViableAltException([email protected][634:7: (n= NOT)?])
在我的Java代碼,我有:
// Exception line
Query query = em.createQuery(queryBuilder.toString());
////
query.setParameter("idTab", idTablet);
if (limit > 0) {
query.setMaxResults(limit);
}
if (dateFrom != null) {
query.setParameter("startDate", dateFrom, TemporalType.DATE);
if (dateTo == null) {
dateTo = new Date();
}
query.setParameter("endDate", dateTo, TemporalType.DATE);
}
messages = (List<MessageEntity>) query.getResultList();
你確定它不是SELECT *? – Ushox 2012-04-13 10:05:36