Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341697

Summary: Exception Description: The parameter name [Id] in the query's selection criteria does not match any parameter name defined in the query
Product: z_Archived Reporter: Lloyd Fernandes <lloyd>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: REOPENED --- QA Contact:
Severity: normal    
Priority: P2 CC: lloyd, scof, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Lloyd Fernandes CLA 2011-04-02 09:08:20 EDT
Build Identifier: 2.3.0-20110326.050514-69

Get this exception when  a class X extend an entity class Y and class X has attribute to change the column name for primary field in class Y

Reproducible: Always

Steps to Reproduce:
(Only annotations used)
1. create class Y as an entity class with primary field
2. create class X that extends class Y and has change attribute to change column name for primary field that is in class Y
3. Create Class A that has an attribute that uses class X
4. persist class A
Comment 1 Tom Ware CLA 2011-04-04 09:16:25 EDT
What does this mean?

"2. create class X that extends class Y and has change attribute to change
column name for primary field that is in class Y"

Can you provide some sample code?
Comment 2 Tom Ware CLA 2011-04-28 10:02:03 EDT
Closing as INVALID due to the lack of information.  Please feel free to reopen if you can provide more information.
Comment 3 Tom Ware CLA 2011-04-28 10:35:30 EDT
Customer provided info:

Hope this clarifies. If not let me know and I will work on a full
> example when I have some time
>
> ------Class Y
> @Entity
> class Y {
> @Id
> private String yId;
> }
>
> ------------Class X
> @Entity
> @AttributeOverride(name = "yId", column = @Column(name = "xId"))
> class X extends Y {
> }
Comment 4 Tom Ware CLA 2011-04-28 10:39:36 EDT
If possible, please make updates to the bug instead of replying to the email.

I am reopening the bug, but can you please provide the query creation code and the full stack trace?
Comment 5 Lloyd Fernandes CLA 2011-07-26 09:14:17 EDT
Switched to Hibernate due to poor support for complex generics and too much difficulty in getting issues resolved
Comment 6 Roman Sinyakov CLA 2015-06-10 08:08:49 EDT
I've got the same issue. It happens where child entity refers not to parent's primary key but to natural key and parent has cascaded association. Here is the sample code:

 @Entity
 class Parent {
 @Id private String id;
 private String key;
 @OneToMany(cascade = CascadeType.ALL, mappedBy = "parent") List<Child> children;
 }


 @Entity
 class Child {
 @Id private String id;
 @ManyToOne @JoinColumn(referencedColumnName = "ket") Parent parent;
 }

...
entityManager.remove(parent);


Exception [EclipseLink-6094] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [uuid] in the query's selection criteria does not match any parameter name defined in the query.
Query: DeleteObjectQuery(DocumentNode{id=101, name='node101', type=FOLDER, version='null', length=0})
	at org.eclipse.persistence.exceptions.QueryException.parameterNameMismatch(QueryException.java:1096)
	at org.eclipse.persistence.internal.expressions.ParameterExpression.getValue(ParameterExpression.java:288)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.translate(DatabaseCall.java:1102)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:241)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.deleteAll(DatasourceCallQueryMechanism.java:127)
	at org.eclipse.persistence.queries.DeleteAllQuery.executeDatabaseQuery(DeleteAllQuery.java:163)
	at org.eclipse.persistence.queries.DeleteAllQuery.executeDeleteAll(DeleteAllQuery.java:222)
	at org.eclipse.persistence.mappings.OneToManyMapping.deleteAll(OneToManyMapping.java:307)
	at org.eclipse.persistence.mappings.OneToManyMapping.preDelete(OneToManyMapping.java:1144)
	at org.eclipse.persistence.descriptors.DescriptorQueryManager.preDelete(DescriptorQueryManager.java:1042)
	at org.eclipse.persistence.queries.DeleteObjectQuery.executeDatabaseQuery(DeleteObjectQuery.java:172)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904)
	at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:803)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
	at org.eclipse.persistence.queries.DeleteObjectQuery.executeInUnitOfWorkObjectLevelModifyQuery(DeleteObjectQuery.java:119)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1790)
	at org.eclipse.persistence.internal.sessions.CommitManager.deleteAllObjects(CommitManager.java:342)
	at org.eclipse.persistence.internal.sessions.CommitManager.deleteAllObjects(CommitManager.java:291)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1444)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1531)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:278)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1169)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:134)
Comment 7 Roman Sinyakov CLA 2015-06-10 08:17:10 EDT
Workaround: the issue reproduces only when @OneToMany end has an attribute "orphanRemoval = true" defined(I missed it in my sample code above). Without it the issue doesn't reproduce.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:08:33 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink