I am not sure if this helps or not but while I
was debugging this problem I noticed that the CpLocation
entities cpLobState member was set but when I looked at the
HashSet of cpLocations on CpLobState entity it says {IndirectSet: not
instantiated}. So I put some break points in the method
where these items are getting set.
For CpLobState this is the member definitions
I have been examining -
…
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cpLobState")
private Set<CpLocation> cpLocations = new
HashSet<CpLocation>(0);
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cpLobState")
@PrivateOwned
private Set<CpStateCoverage> cpStateCoverages = new
HashSet<CpStateCoverage>(0);
And this is the code
to add the cpLocation to CpLobState –
public boolean addCpLocation(final CpLocation cpLocation) {
boolean retVal = false;
if (cpLocation != null) {
retVal =
this.cpLocations.add(cpLocation);
// Set the parent
object
cpLocation.setCpLobState(this);
}
return
retVal;
}
And
this is the code to set the CpLobState in CpLocation
public void setCpLobState(final CpLobState cpLobState) {
this.cpLobState = cpLobState;
if (this.cpLobState != null && !this.cpLobState.getCpLocations().contains(this)) {
this.cpLobState.addCpLocation(this, false);
}
}
FYI
when I examine the cpStateCoverages it says {[]} vs the not
instantiated message.
I
have stepped through this code and it looks like it works
fine and returns true on the add method call.
Thanks
for your help on this.
Hi Kevin,
Can you send more info of the entity on the other side of
the relationship? The one that your tried to merge?
I'm trying to reproduce your problem so I can debug it
further.
Thanks,
Guy
On 03/02/2011 3:18 PM, Kevin Haskett wrote:
Here is the stack trace through the struts Action call -
[2/3/11 13:21:34:578 CST] 0000002d SystemErr R Local Exception
Stack:
Exception [EclipseLink-6094] (Eclipse Persistence Services -
2.2.0.v20110202-r8913):
org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [LOB_STATE_ID] in the query's
selection criteria does not match any parameter name defined in the
query.
Query: ReadAllQuery(name="cpLocations" referenceClass=CpLocation
sql="SELECT t0.LOCATION_ID, t1.LOCATION_ID, t0.BUILDINGS_SAME_ADDRESS,
t1.CLASS_CODE, t0.COUNTY_CODE, t0.COUNTY_NAME, t0.LOCATION_NUMBER,
t1.EARTHQUAKE_ZONE, t1.FIRE_PROTECTION_FD, t1.FIRE_PROTECTION_HYDRANT,
t0.LOCATION_STATE, t1.PREMIUM_ACTUAL, t1.PROTECTION_CLASS,
t1.PROTECTION_CLASS_OVERRIDE, t1.TERR_MULT, t1.TERRITORY,
t1.TERRITORY_BCEG, t1.TERRITORY_PREMOP, t1.TERRITORY_TIER,
t0.ACTION_CODE, t1.LOB_STATE_ID, t0.TRANSACTION_ID FROM CP_LOCATION t0,
CP_LOCATION_PKG t1 WHERE ((t1.LOB_STATE_ID = ?) AND (t1.LOCATION_ID =
t0.LOCATION_ID))")
at
org.eclipse.persistence.exceptions.QueryException.parameterNameMismatch(
QueryException.java:1050)
at
org.eclipse.persistence.internal.expressions.ParameterExpression.getValu
e(ParameterExpression.java:246)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseCall.translate(D
atabaseCall.java:951)
at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
ecuteCall(DatasourceCallQueryMechanism.java:206)
at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
ecuteCall(DatasourceCallQueryMechanism.java:193)
at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
ecuteSelectCall(DatasourceCallQueryMechanism.java:264)
at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.se
lectAllRows(DatasourceCallQueryMechanism.java:647)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.select
AllRowsFromTable(ExpressionQueryMechanism.java:2558)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.select
AllRows(ExpressionQueryMechanism.java:2517)
at
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery
(ReadAllQuery.java:410)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuer
y(ObjectLevelReadQuery.java:1080)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java
:808)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevel
ReadQuery.java:1040)
at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:3
83)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork
(ObjectLevelReadQuery.java:1126)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecute
Query(UnitOfWorkImpl.java:2842)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
bstractSession.java:1521)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
bstractSession.java:1503)
at
org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.insta
ntiate(QueryBasedValueHolder.java:98)
at
org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.insta
ntiateForUnitOfWorkValueHolder(QueryBasedValueHolder.java:113)
at
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.insta
ntiateImpl(UnitOfWorkValueHolder.java:156)
at
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.insta
ntiate(UnitOfWorkValueHolder.java:222)
at
org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValu
e(DatabaseValueHolder.java:88)
at
org.eclipse.persistence.indirection.IndirectSet.buildDelegate(IndirectSe
t.java:192)
at
org.eclipse.persistence.indirection.IndirectSet.getDelegate(IndirectSet.
java:343)
at
org.eclipse.persistence.indirection.IndirectSet.size(IndirectSet.java:50
0)
at
org.eclipse.persistence.internal.queries.CollectionContainerPolicy.sizeF
or(CollectionContainerPolicy.java:177)
at
org.eclipse.persistence.mappings.CollectionMapping.mergeIntoObject(Colle
ctionMapping.java:1395)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.mergeIntoObje
ct(ObjectBuilder.java:3254)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChangesOfClo
neIntoWorkingCopy(MergeManager.java:525)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChanges(Merg
eManager.java:263)
at
org.eclipse.persistence.mappings.CollectionMapping.mergeIntoObject(Colle
ctionMapping.java:1452)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.mergeIntoObje
ct(ObjectBuilder.java:3254)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChangesOfClo
neIntoWorkingCopy(MergeManager.java:525)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChanges(Merg
eManager.java:263)
at
org.eclipse.persistence.mappings.CollectionMapping.mergeIntoObject(Colle
ctionMapping.java:1452)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.mergeIntoObje
ct(ObjectBuilder.java:3254)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChangesOfClo
neIntoWorkingCopy(MergeManager.java:525)
at
org.eclipse.persistence.internal.sessions.MergeManager.mergeChanges(Merg
eManager.java:263)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.mergeCloneWithR
eferences(UnitOfWorkImpl.java:3467)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.merg
eCloneWithReferences(RepeatableWriteUnitOfWork.java:363)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.mergeCloneWithR
eferences(UnitOfWorkImpl.java:3427)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.mergeInternal(Ent
ityManagerImpl.java:452)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.merge(EntityManag
erImpl.java:429)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at
org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManag
erInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
at $Proxy29.merge(Unknown Source)
at
com.gmrc.jpa.domain.controller.CpTransactionManagerImpl.update(CpTransac
tionManagerImpl.java:1169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinp
oint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:149)
at
org.springframework.dao.support.PersistenceExceptionTranslationIntercept
or.invoke(PersistenceExceptionTranslationInterceptor.java:138)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:171)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invok
e(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:204)
at $Proxy54.update(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinp
oint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invok
e(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:204)
at $Proxy55.update(Unknown Source)
at
com.gmrc.cpp.struts.actions.CppBaseAction.persistCpTrans(CppBaseAction.j
ava:1245)
at
com.gmrc.cpp.struts.actions.CppBaseAction.persistCpTrans(CppBaseAction.j
ava:1233)
at
com.gmrc.im.struts.actions.IMLobAction.saveBasic(IMLobAction.java:669)
at
com.gmrc.im.struts.actions.IMLobAction.save(IMLobAction.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at
com.gmrc.cpp.struts.actions.CppBaseAction.dispatchMethod(CppBaseAction.j
ava:902)
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
Sent: Thursday, February 03, 2011 2:02 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Exception with ManytoOne with latest
version of eclipselink.jar
Can you please send a more complete stack trace?
Kevin Haskett wrote:
This happened during a merge of a higher level object in my domain
tree.
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
Sent: Thursday, February 03, 2011 1:51 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Exception with ManytoOne with latest
version of eclipselink.jar
Hi Kevin,
What query are you running?
Thanks,
Tom
Kevin Haskett wrote:
In the previous version we were using 2.2.0.v20100731-r7961 and were
not
seeing this issue -
Exception [EclipseLink-6094] (Eclipse Persistence Services -
2.2.0.v20110202-r8913):
_org.eclipse.persistence.exceptions.QueryException_
Exception Description: The parameter name [LOB_STATE_ID] in the
query's
selection criteria does not match any parameter name defined in the
query.
Query: ReadAllQuery(name="cpLocations" referenceClass=CpLocation
sql="SELECT t0.LOCATION_ID, t1.LOCATION_ID,
t0.BUILDINGS_SAME_ADDRESS,
t1.CLASS_CODE, t0.COUNTY_CODE, t0.COUNTY_NAME, t0.LOCATION_NUMBER,
t1.EARTHQUAKE_ZONE, t1.FIRE_PROTECTION_FD,
t1.FIRE_PROTECTION_HYDRANT,
t0.LOCATION_STATE, t1.PREMIUM_ACTUAL, t1.PROTECTION_CLASS,
t1.PROTECTION_CLASS_OVERRIDE, t1.TERR_MULT, t1.TERRITORY,
t1.TERRITORY_BCEG, t1.TERRITORY_PREMOP, t1.TERRITORY_TIER,
t0.ACTION_CODE, t1.LOB_STATE_ID, t0.TRANSACTION_ID FROM CP_LOCATION
t0,
CP_LOCATION_PKG t1 WHERE ((t1.LOB_STATE_ID = ?) AND (t1.LOCATION_ID =
t0.LOCATION_ID))")
at
org.eclipse.persistence.exceptions.QueryException.parameterNameMismatch(
_QueryException.java:1050_)
at
org.eclipse.persistence.internal.expressions.ParameterExpression.getValu
e(_ParameterExpression.java:246_)
Here are my entities -
@Entity
@Table(name = "CP_LOCATION")
@Cache(alwaysRefresh = *true*)
@SecondaryTable(name = "CP_LOCATION_PKG")
@Converter(name = "boolean", converterClass =
com.gmrc.jpa.domain.mappings.converters.BooleanYNConverter.*class*)
*public* *class* CpLocation *extends* BaseDomain *implements*
Comparable<CpLocation> {
// Fields
@Id
@GeneratedValue(strategy = GenerationType./IDENTITY/)
@Column(name = "LOCATION_ID", unique = *true*, nullable =
*false*,
precision = 11, scale = 0)
*private* Long locationId;
@ManyToOne(cascade = CascadeType./ALL/)
@JoinColumn(name = "TRANSACTION_ID", nullable = *false*)
*private* CpTransaction cpTransaction;
@Column(name = "LOCATION_NUMBER", nullable = *false*)
*private* Integer displayNumber = Integer./valueOf/(0); // same
as
location number
...
@Column(name = "TERRITORY_TIER", length = 10, table =
"CP_LOCATION_PKG")
*private* String territoryTier;
// _bi_-directional many-to-one association to CpLobState
@ManyToOne()
@JoinColumn(name = "LOB_STATE_ID", table = "CP_LOCATION_PKG")
*private* CpLobState cpLobState;
@Entity
@Table(name = "CP_LOB_STATE")
@Converter(name = "boolean", converterClass =
com.gmrc.jpa.domain.mappings.converters.BooleanYNConverter.*class*)
* public* *class* CpLobState *extends* BaseDomain {
// Fields
@Id
@GeneratedValue(strategy = GenerationType./IDENTITY/)
@Column(name = "LOB_STATE_ID", unique = *true*, nullable =
*false*,
precision = 11, scale = 0)
*private* Long lobStateId;
@ManyToOne(cascade = CascadeType./ALL/)
@JoinColumn(name = "LOB_ID", nullable = *false*)
*private* CpLob cpLob;
@Column(name = "LOB_STATE", nullable = *false*, length = 2)
*private* String lobState;
...
Is there something different now that I need to do to fix this?
This message (including any attachments) is intended only for the use
of
the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged,
confidential,
and exempt from disclosure under applicable law or may constitute as
attorney work product. If you are not the intended recipient, you are
hereby notified that any use, dissemination, distribution, or copying
of
this communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and (i)
destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication. Thank you.
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.
Thank you.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.
Thank you.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.