eclipselink icon indicating copy to clipboard operation
eclipselink copied to clipboard

Entity identifier 'this' is broken in JPQL UPDATE queries: The state field cannot be resolved

Open anija-anil opened this issue 1 year ago • 0 comments

EclipseLink reports an error "The state field cannot be resolved" when this. is used within JPQL UPDATE queries. Here is one example,

Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Problem compiling [UPDATE Triangle SET this.sides=?2, this.perimeter=?3 WHERE this.distinctKey=?1]. 
[20, 30] The state field cannot be resolved.
[37, 51] The state field cannot be resolved.
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1848)
	at io.openliberty.data.internal.persistence.RepositoryImpl.invoke(RepositoryImpl.java:1079)
	... 38 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [UPDATE Triangle SET this.sides=?2, this.perimeter=?3 WHERE this.distinctKey=?1]. 
[20, 30] The state field cannot be resolved.
[37, 51] The state field cannot be resolved.
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:169)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:358)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:292)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:174)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:144)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:120)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:107)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:91)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1846)
	... 39 more

anija-anil avatar Jul 02 '24 07:07 anija-anil