Skip to content

Commit

Permalink
NEW should be legal as a token in a state field path expression in JPQL.
Browse files Browse the repository at this point in the history
A multi-node token that has NEW as one of its elements should work just fine in a JPQL query.

See #3128
  • Loading branch information
gregturn committed Aug 28, 2023
1 parent bdbab71 commit 34a9c04
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ identification_variable
| INNER
| KEY
| LEFT
| NEW
| ORDER
| OUTER
| FLOOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,4 +1584,20 @@ and CTM_UTLRAW_NLSSORT_LOWER(b.nome) like lower(:nome)
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
""");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -967,4 +967,20 @@ void timeShouldBeAValidParameterName() {
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
""");
}
}

0 comments on commit 34a9c04

Please sign in to comment.