私はこのクエリを実行しようとしているjpqlの初心者です:
String queryString="" +
"SELECT u,sr " +
"FROM spot_review sr, user u, spot s " +
"WHERE " +
"sr.user_iduser IN (SELECT ALL fu.user_iduserto FROM favorite_user fu WHERE fu.user_iduserfrom=:"+User.STRING_ID_USER+") and " +
"sr.user_iduser = u.id_user and " +
"sr.spot_idspot = s.id_spot and " +
"sr.datereview IN (SELECT MAX(sr2.datereview) FROM spot_review sr2 GROUP BY sr2.user_iduser) " +
"GROUP BY u.id_user " +
"ORDER BY sr.user_iduser " +
"LIMIT :"+ServiceConstants.STRING_PAGE_NUMBER+",:"+ServiceConstants.STRING_ROWS_PER_PAGE;
Query query = entityManager.createQuery(queryString);
しかし、私はこのエラーが発生します:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: . near line 1, column 87 [SELECT u,sr FROM spot_review sr, user u, spot s WHERE sr.user_iduser IN (SELECT ALL fu.user_iduserto FROM favorite_user fu WHERE fu.user_iduserfrom=:idUser) and sr.user_iduser = u.id_user and sr.spot_idspot = s.id_spot and sr.datereview IN (SELECT MAX(sr2.datereview) FROM spot_review sr2 GROUP BY sr2.user_iduser) GROUP BY u.id_user ORDER BY sr.user_iduser LIMIT :pageNumber,:rowsPerPage]
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
$Proxy26.createQuery(Unknown Source)
com.windy.server.dao.jpa.JpaDaoUser.getBestFavoriteUsersOBuser(JpaDaoUser.java:35)
com.windy.server.service.impl.WindersMainServiceImpl.getBestFavoriteUsersOBuser(WindersMainServiceImpl.java:23)
com.windy.server.controllers.WindersMainController.bestFavoriteUsersOBuserMobile(WindersMainController.java:93)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
SQLクエリは機能していますが、このクエリで何が間違っているのかわかりません...
よろしくお願いいたします。