What is wrong with this NamedQuery
?
@NamedQuery(name = "Queries.findQueryIdsByRoleOfSameSid",
query = "SELECT q "+
"FROM Queries q "+
"WHERE ((q.issueRole = :issueRole) AND "+
"(SELECT COUNT(*) FROM Queries qb WHERE ( (q.sessionId=qb.sessionId) AND (q.issueRole=qb.issueRole))) IS NOT EMPTY)"+
"ORDER BY q.reqTime "),
and this is the Queries Entity attributes:
public class Queries implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "query_id")
private Integer queryId;
@Basic(optional = false)
@NotNull
@Column(name = "issue_time")
private int issueTime;
@Basic(optional = false)
@NotNull
@Column(name = "issue_role")
private int issueRole;
@Basic(optional = false)
@NotNull
@Column(name = "req_time")
@Temporal(TemporalType.TIMESTAMP)
private Date reqTime;
@Basic(optional = false)
@NotNull
@Column(name = "sucess_flag")
private int sucessFlag;
@Size(max = 50)
@Column(name = "session_id")
private String sessionId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "queriesQueryId")
private Collection<Statement> statementCollection;
I am getting this error, and the modul is not deployed:
Exception Description: Syntax error parsing the query [Queries.findQueryIdsByRoleOfSameSid: SELECT q FROM Queries q WHERE ((q.issueRole = :issueRole) AND (SELECT COUNT(*) FROM Queries qb WHERE ( (q.sessionId=qb.sessionId) AND (q.issueRole=qb.issueRole))) IS NOT EMPTY)ORDER BY q.reqTime ], line 1, column 44: syntax error at [=]. Internal Exception: MismatchedTokenException(82!=84). Please see server.log for more details.`
FYI, I am working with netbeans 7.2.1, default org.eclipse.persistence.jpa.PersistenceProvider(JPA 2.0)
in persistence.xml
I even tried to upgrade the eclipsLink version to 2.6, but failed. I don't know why, I exactly followed these instrctions How do you use EclipseLink 2.3 as persistence provider in NB 7? And also this one Adding the latest EclipseLink version to a Netbeans project?
Please help me out