Home > Java > body text

Query gets syntax error even though query is indeed correct

PHPz
Release: 2024-02-22 13:16:13
forward
868 people have browsed it

php editor Youzi will help you solve common problems in Java programming! Sometimes even if the query statement is correct, there may be syntax errors, which confuses many beginners. This article will discuss this issue to help readers deeply understand common errors in Java programming and solve the challenge of grammatical errors in query statements.

Question content

I am planning to deploy my ear file on glassfish, but when I try to deploy the ear I get:

2023-11-23t10:46:59.388 0100|Critical: An exception occurred while calling the class org.glassfish.persistence.jpa.jpadeployer prepare method 2023-11-23t10:46:59.389 0100|Critical: Calling the class Exception occurred while preparing method org.glassfish.javaee.full.deployment.eardeployer 2023-11-23t10:46:59.389 0100|Critical: Exception occurred while preparing application 2023-11-23t10:46:59.389 0100|Critical: Exception[ eclipselink - 8025] (eclipse Persistence Service - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.jpqlexception Exception description: Syntax error while parsing query

The query is a named query, I also tested it using eclipselink in another project not using glassfish (it was not deployed on the application server) and it worked fine;

I can't figure out what could be going wrong, if the query runs fine using it directly, why doesn't it work when deployed on glassfish?

This is a named query

@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";
Copy after login

I have used this query in a java application (a simple java project) and it works fine; The database is mssql

Solution

The problem is related to the glassfish version, in this version

It works fine, and in this one:

does not work, in other words, the open source version cannot perform very complex queries (such as the query in the example);

I know there's probably no one else on the planet who has the problem I'm having, and the technology is very old; but I don't understand why someone took my two cents away! !

The above is the detailed content of Query gets syntax error even though query is indeed correct. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template