Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 第1行附近的间隔:由以下原因引起:org.hibernate.hql.internal.ast.QuerySyntaxException_Mysql_Sql_Hibernate_Date_Jpa - Fatal编程技术网

Mysql 第1行附近的间隔:由以下原因引起: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>

原因: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> 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有。