Skip to content

EclipseLink fails resolving unqualified identifier property using IN on batch delete by Id #3990

@joeltran

Description

@joeltran

Dear spring-data-jpa,

In the following issue, there was 2 issues described (I should have created 2 separate issues). The first issue has been resolved. The second issue is still pending and I would like to have your assessment on it.

#3983 (comment))

The second issue is with regards to the deleteAllByIdInBatch() method in the above example which is causing the following dump:

Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 4.0.7.v202506240759-923a428d4722d199eff24e730890e156ce7ea9de): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [delete from IssueTable x where id in :ids]. 
[31, 33] The identification variable 'id' is not defined in the FROM clause.
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:159)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:337)

The query is created by the Spring Data jpa method SimpleJpaRepository<T,ID>.deleteAllByIdInBatch(Iterable) which is then calling the "Query query = entityManager.createQuery(queryString);" with a wrong SQL.

Wrong: "delete from IssueTable x where id in :ids"
Valid: "delete from IssueTable x where x.id in :ids

Here is a simple unit test testDeleteAllByIdInBatch() to reproduce the issue (java files + pom) to reproduce the issue.

pom.xml.txt
SpringJPAIssueTest.java
IssueTable.java
IssueRepository.java

Best regards,
Joel

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions