NEW should be legal as a token in a state field path expression in JPQL.

A multi-node token that has NEW as one of its elements should work just fine in a JPQL query.

See #3128
This commit is contained in:
Greg L. Turnquist
2023-08-28 12:05:57 -05:00
parent c7d403a37a
commit e5ec1aa0d3
3 changed files with 33 additions and 0 deletions

View File

@@ -602,6 +602,7 @@ identification_variable
| INNER
| KEY
| LEFT
| NEW
| ORDER
| OUTER
| FLOOR

View File

@@ -1584,4 +1584,20 @@ class HqlQueryRendererTests {
order by CTM_UTLRAW_NLSSORT_LOWER(b.nome) ASC
""");
}
@Test // GH-3128
void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
assertQuery("""
SELECT j
FROM AgentUpdateTask j
WHERE j.creationTimestamp < :date
AND (j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.NEW
OR
j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.STARTED
OR
j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.QUEUED)
ORDER BY j.id
""");
}
}

View File

@@ -967,4 +967,20 @@ class JpqlQueryRendererTests {
WHERE L.isLocked = FALSE OR L.forceUnlockTime < :time
""");
}
@Test // GH-3128
void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
assertQuery("""
SELECT j
FROM AgentUpdateTask j
WHERE j.creationTimestamp < :date
AND (j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.NEW
OR
j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.STARTED
OR
j.status = com.ca.apm.acc.configserver.core.domain.jobs.AgentUpdateTaskStatus.QUEUED)
ORDER BY j.id
""");
}
}