Hi Andreas,
You are probably using optimistic version locking.
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Locking/Optimistic_Locking
You can use pessimistic locking or add version column to BudgetGroup object.
Martin Vojtek
From: Andreas Joseph Krogh [mailto:andreas@xxxxxxxxxx]
Sent: 7. září 2014 16:23
To: EclipseLink User Discussions
Subject: [eclipselink-users] Exception when calling entityManager.remove: The parameter name [version] in the query's selection criteria does not match any parameter name defined in the query
i'm calling remove() like this:
entityManager.remove(entityManager.getReference(someClass, id))
which results in this Exception:
Caused by: Exception [EclipseLink-6094] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [version] in the query's selection criteria does not match any parameter name defined in the query.
Query: DeleteObjectQuery(BudgetGroup[id=861252])
at org.eclipse.persistence.exceptions.QueryException.parameterNameMismatch(QueryException.java:1089)
at org.eclipse.persistence.internal.expressions.ParameterExpression.getValue(ParameterExpression.java:275)
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.deleteObject(DatasourceCallQueryMechanism.java:203)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.deleteObject(StatementQueryMechanism.java:104)
at org.eclipse.persistence.queries.DeleteObjectQuery.executeDatabaseQuery(DeleteObjectQuery.java:218)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:798)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.DeleteObjectQuery.executeInUnitOfWorkObjectLevelModifyQuery(DeleteObjectQuery.java:119)
Any hints on what's causing this?
--
CTO / Partner - Visena AS