查询时出现语法错误,即使查询确实正确

问题描述 投票:0回答:1

我打算在 glassfish 上部署我的耳朵文件,但是当我尝试部署耳朵时,我得到:

2023-11-23T10:46:59.388+0100|Severe: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method 2023-11-23T10:46:59.389+0100|Severe: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method 2023-11-23T10:46:59.389+0100|Severe: Exception while preparing the app 2023-11-23T10:46:59.389+0100|Severe: Exception [EclipseLink-8025] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JPQLException Exception Description: Syntax error parsing the query

该查询是一个命名查询,我也在另一个不使用 glassfish 的项目中使用 eclipseLink 对其进行了测试(未将其部署在应用程序服务器上)并且运行良好;

我无法弄清楚可能出了什么问题,如果直接使用它查询运行良好,为什么部署在 glassfish 上时它不起作用?

这是命名查询

@Entity
@Table(name = "T_EXE_PROC")
@TableGenerator(name = "ExecuProcGenerator", table = "T_SEQ", pkColumnName = "SEQ_COL", valueColumnName = "SEQ_CONTATOR", pkColumnValue = "EXE_PRO_SEQUE", allocationSize = 10, initialValue = 0)
@NamedQueries({ 

        @NamedQuery(name = "ExeProc.findLastExecProcs", query = "SELECT DISTINCT (e.procedure) FROM ExeProc e WHERE e.cdExecProcs IN ( SELECT DISTINCT (e.cdExecProcs) FROM ExeProc e, ExeStep s where s.ExecProc.cdExecProcs = e.cdExecProcs AND s.stat.cdStation=:cdStation and s.oper.ceLogin=:ceLogin) and e.statusExecProc = :statusExecProc and e.procedure.status = 1 order by e.lastModifiedStepTime DESC"),

        })
public class ExeProc implements Serializable {
    
    private static final long serialVersionUID = 12348979846545312L;
    
    
    public static final String FIND_LAST_EXEC_PROC = "ExeProc.findLastExecProcs";

我已经在 java 应用程序(一个简单的 java 项目)中使用了该查询,并且运行良好; 数据库是MSSQL

java jpa eclipselink glassfish-3
1个回答
0
投票

问题已被转移到glassfish的版本,在这个版本中

Oracle GlassFish Server 3.1.2.2(版本 5)

它工作正常,而在这个中:

GlassFish 服务器开源版 3.1.2.2(构建 5)

不起作用,换句话说,开源版本无法执行非常复杂的查询(如示例中的查询);

我知道这个星球上可能没有其他人能遇到我遇到的问题,技术非常古老;但我不明白为什么有人拿走了我两分!!

© www.soinside.com 2019 - 2024. All rights reserved.