Mysql 第1行附近的间隔:由以下原因引起:org.hibernate.hql.internal.ast.QuerySyntaxException
原因:org.hibernate.hql.internal.ast.QuerySyntaxException: 意外标记:间隔接近 我的问题是:Mysql 第1行附近的间隔:由以下原因引起:org.hibernate.hql.internal.ast.QuerySyntaxException,mysql,sql,hibernate,date,jpa,Mysql,Sql,Hibernate,Date,Jpa,原因:org.hibernate.hql.internal.ast.QuerySyntaxException: 意外标记:间隔接近 我的问题是: private static final String USERS_NOT_ACTION_IN_LAST_MONTH = select u from myTable u where u.lastDate + INTERVAL 30 DAY <= CURDATE(); @Override public List<MyEntity>
private static final String USERS_NOT_ACTION_IN_LAST_MONTH = select u from myTable u where u.lastDate + INTERVAL 30 DAY <= CURDATE();
@Override
public List<MyEntity> getItemOlderThanMonth() {
Query q = _entityManager.createQuery(USERS_NOT_ACTION_IN_LAST_MONTH, MyEntity.class);
return q.getResultList();
}
private static final String USERS\u NOT\u ACTION\u IN\u LAST\u MONTH=从myTable u中选择u,其中u.lastDate+INTERVAL 30 DAY您可以通过查询参数计算当前日期(当前日期-30)
private static final String USERS\u NOT\u ACTION\u IN\u LAST\u MONTH=从myTable u中选择u,其中u.lastDate您可以通过查询参数计算当前日期(当前日期-30)
private static final String USERS_NOT_ACTION_IN_LAST_MONTH=从myTable u中选择u where u.lastDate ANSI SQL方式:INTERVAL'30'DAY
在性能方面从myTable u where u.lastDate中选择u,但得到相同的错误:“意外令牌:INTERVAL”hql没有间隔语法。MySQL具有.ANSI SQL方式:INTERVAL'30'DAY
在性能方面从myTable u中选择u,其中u.lastDate但得到相同的错误:“意外令牌:INTERVAL”hql没有INTERVAL语法。MySQL有。