The parameter name in the query's selection criteria does not match any parameter name defined in th [message #657595] |
Thu, 03 March 2011 06:56  |
Eclipse User |
|
|
|
I'm getting this rather lenghty exception and can't make heads or tails of it.
It seems the exception is trying to tell me that I specified a parameter name, that is not present in the query.
So something like "... where a = :a" and then do a query.setParameter("b", ...).
But I never created that query. (Eclipselink 2.2.0).
Local Exception Stack:
Exception [EclipseLink-6094] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [relationstandnr] in the query's selection criteria does not match any parameter name defined in the query.
Query: ReadAllQuery(name="iRelationstandToCatsWhereIAmRelationstand " referenceClass=RelationstandToCat sql="SELECT relationstand2catnr, dwhby, dwhmodified, relationstandcatnr, relationstandnr FROM rel
ationstand_to_cat WHERE (relationstandnr = ?)")
at org.eclipse.persistence.exceptions.QueryException.parameterN ameMismatch(QueryException.java:1050)
at org.eclipse.persistence.internal.expressions.ParameterExpres sion.getValue(ParameterExpression.java:246)
at org.eclipse.persistence.internal.databaseaccess.DatabaseCall .translate(DatabaseCall.java:951)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:206)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeSelectCall(DatasourceCallQueryMechanism.jav a:264)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.selectAllRows(DatasourceCallQueryMechanism.java:64 7)
at org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2 558)
at org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRows(ExpressionQueryMechanism.java:2517)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLe velReadQuery(ReadAllQuery.java:410)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute DatabaseQuery(ObjectLevelReadQuery.java:1080)
at org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:808)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:1040)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAll Query.java:383)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute InUnitOfWork(ObjectLevelReadQuery.java:1126)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2842)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1521)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1503)
at org.eclipse.persistence.internal.indirection.QueryBasedValue Holder.instantiate(QueryBasedValueHolder.java:98)
at org.eclipse.persistence.internal.indirection.QueryBasedValue Holder.instantiateForUnitOfWorkValueHolder(QueryBasedValueHo lder.java:113)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValue Holder.instantiateImpl(UnitOfWorkValueHolder.java:156)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValue Holder.instantiate(UnitOfWorkValueHolder.java:222)
at org.eclipse.persistence.internal.indirection.DatabaseValueHo lder.getValue(DatabaseValueHolder.java:88)
at org.eclipse.persistence.indirection.IndirectList.buildDelega te(IndirectList.java:237)
at org.eclipse.persistence.indirection.IndirectList.getDelegate (IndirectList.java:397)
at org.eclipse.persistence.indirection.IndirectList.size(Indire ctList.java:726)
at org.eclipse.persistence.internal.queries.CollectionContainer Policy.sizeFor(CollectionContainerPolicy.java:177)
at org.eclipse.persistence.mappings.CollectionMapping.mergeInto Object(CollectionMapping.java:1395)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.m ergeIntoObject(ObjectBuilder.java:3254)
at org.eclipse.persistence.internal.sessions.MergeManager.merge ChangesOfCloneIntoWorkingCopy(MergeManager.java:525)
at org.eclipse.persistence.internal.sessions.MergeManager.merge Changes(MergeManager.java:263)
at org.eclipse.persistence.mappings.CollectionMapping.mergeInto Object(CollectionMapping.java:1452)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.m ergeIntoObject(ObjectBuilder.java:3254)
at org.eclipse.persistence.internal.sessions.MergeManager.merge ChangesOfCloneIntoWorkingCopy(MergeManager.java:525)
at org.eclipse.persistence.internal.sessions.MergeManager.merge Changes(MergeManager.java:263)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.mer geCloneWithReferences(UnitOfWorkImpl.java:3467)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.mergeCloneWithReferences(RepeatableWriteUnitOfWork.j ava:363)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.mer geCloneWithReferences(UnitOfWorkImpl.java:3427)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.merge Internal(EntityManagerImpl.java:452)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.merge (EntityManagerImpl.java:429)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at nl.knowledgeplaza.util.jpa.EntityManagerExtender.invoke(Enti tyManagerExtender.java:384)
at $Proxy4.merge(Unknown Source)
at org.tbee.swing.jpa.JpaObjectNavigatorModel$1.call(JpaObjectN avigatorModel.java:936)
at org.tbee.swing.jpa.JpaObjectNavigatorModel.doSave(JpaObjectN avigatorModel.java:964)
at org.tbee.swing.jpa.JpaObjectNavigatorModel.doSave(JpaObjectN avigatorModel.java:905)
at org.tbee.swing.jpa.JpaObjectNavigatorBar$3.actionPerformed(J paObjectNavigatorBar.java:171)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unk nown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This is the table definition of relationstand_to_cat:
Column name Type Nulls
relationstand2catnr integer yes
relationstandnr integer no
relationstandcatnr integer no
dwhmodified datetime year to second yes
dwhby integer yes
|
|
|
|
|
Re: The parameter name in the query's selection criteria does not match any parameter name defined i [message #657659 is a reply to message #657645] |
Thu, 03 March 2011 10:33   |
Eclipse User |
|
|
|
No, I'm not doing anything here, it's the result of a multi-cascade on an object (Relation) being merged into an EM. (Look further up the stacktrace.)
@OneToMany(mappedBy = "iRelationstand", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.RelationstandToCat.class, cascade = {CascadeType.REFRESH,CascadeType.PERSIST,CascadeType.MERGE} )
volatile protected java.util.List<nl.reinders.bm.RelationstandToCat> iRelationstandToCatsWhereIAmRelationstand = new java.util.ArrayList<nl.reinders.bm.RelationstandToCat>();
It only occurs when this merge happens (when the users presses the save button, the screen works fine until then).
On 3-3-2011 16:04, James wrote:
> The query is for the iRelationstandToCatsWhereIAmRelationstand relationship. Please include the mapping for this attribute.
>
> It could be a case issue. Are you using a native SQL query to retrieve the object being merged?
>
> Does this error occur every time you access this relationship, or only in a certain case?
>
|
|
|
|
|
|
|
|
|
Re: The parameter name in the query's selection criteria does not match any parameter name defined i [message #907281 is a reply to message #660756] |
Mon, 03 September 2012 12:47  |
Eclipse User |
|
|
|
In the case I have experienced the navigation definitions were all correct, and there was no bug related to the capslock of the referenced column.
Basically, it seems that eclipselink expectes for atleast one of your @joincolumn annotations to not be flagged as readonly. (e.g. if, (a) all your join columns are NOT falgged as readonly, that is the fields are insertable and updatable, you will get the error stating that you cannot have more than one joincolumn specifying the the target field as wrtiable; (b) if all your joinColumns are flagged as readonly, you will get the error "The parameter name [someField] in the query's selection criteria does not match any parameter name defined in the query.")
To fix it, download the source code, set a break point in the getValue() method that is exploding.
Look at the translation table parameter, see the name of the dabase table contained in this translation object.
Looking at this translation object, you will notice that most of the properties of your database table are contained within it, with the expection of the database FIELD whose name appeared in the exception you obtained.
Finally, find the correnspoding JPA entity that maps to the table in the "translation" parameter and fix the joinColumn annotations in this entity. You must have at least one of them not flagged as read only. (cut away the insertable=false, updatable=false)
Best of luck.
[Updated on: Tue, 04 September 2012 02:42] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04362 seconds