我正在尝试创建一个@NamedQuery
将包含以下相关子查询:
@NamedQuery(name = "Drcomments.findByOrderDesc", query = " SELECT a FROM ( SELECT ROWNUMBER() OVER(ORDER BY d.drcommentsPK.commentSecondaryCode DESC) AS EL_ROWNM , d.drcommentsPK.commentSecondaryCode , d.commentSecondaryCodeDescription FROM Drcomments d WHERE d.drcommentsPK.commentPrimaryCode = 1 ) a WHERE a.EL_ROWNM < 4 and a.EL_ROWNM > 0 ")})
问题是我收到此错误:
"Exception [EclipseLink-8025] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing the query [Drcomments.findByOrderDesc: SELECT a FROM ( SELECT ROWNUMBER() OVER(ORDER BY d.drcommentsPK.commentSecondaryCode DESC) AS EL_ROWNM , d.drcommentsPK.commentSecondaryCode , d.commentSecondaryCodeDescription FROM Drcomments d WHERE d.drcommentsPK.commentPrimaryCode = 1 ) a WHERE a.EL_ROWNM < 4 and a.EL_ROWNM > 0 ], line 1, column 15: unexpected token [(].
Internal Exception: org.eclipse.persistence.internal.jpa.parsing.jpql.InvalidIdentifierException"
@NamedQuery 是否支持相关子查询?如果是这样,我如何创建一个将执行这种查询的命名查询?
提前致谢。