Re: Strange problem with database, relationship and editingContext
Re: Strange problem with database, relationship and editingContext
- Subject: Re: Strange problem with database, relationship and editingContext
- From: Chuck Hill <email@hidden>
- Date: Fri, 17 Nov 2006 08:11:40 -0800
Hi Daniele,
The problem appears to be in your model, not in your code.
On Nov 17, 2006, at 7:50 AM, Daniele Corti wrote:
Hi all,
I have a strange error on a simple
EOSortOrdering.sortedArrayUsingKeyOrderArray
this is the errer message:
Application: AffittiV2Admin
Error: java.lang.IllegalStateException:
sqlStringForKeyValueQualifier: attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier
(_eofInv_LKRegion_children.className
If you see _eofinv in an error message, it means that EOF is
generating an inverse (going the other way) relationship for
something in your model. If your model is not setup correctly (or,
in a few cases, if you hit a bug in EOF), EOF is not able to
correctly generate this inverse relationship.
Unrelated: storing the class name in the database is unusual. :-)
= 'class com.gestweb.locationkit.LKRegion') failed because
attribute identified by key '_eofInv_LKRegion_children.className'
was not reachable from from entity 'AFProperty'
What is AFProperty? How does this relate to LKRegion? It seems to
be complaining about not being able to navigate from an AFProperty to
an LKRegion.
You will need to post information on how you modeled the children
relationship for us to be able to sort this out.
Chuck
Reason: sqlStringForKeyValueQualifier: attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier
(_eofInv_LKRegion_children.className = 'class
com.gestweb.locationkit.LKRegion') failed because attribute
identified by key '_eofInv_LKRegion_children.className' was not
reachable from from entity 'AFProperty'
well the code that generate this error is:
public NSArray childrenSortedByName() {
NSLog.out.appendln("CHILDREN: "+children()+"\neditingContext:
"+this.editingContext()+" Session.default: "+GiveSession.session
().defaultEditingContext());
NSLog.out.appendln("Child: "+((EOEnterpriseObject)children
().lastObject()).editingContext());
return EOSortOrdering.sortedArrayUsingKeyOrderArray (children(),
new NSArray(ascendingNameOrdering));
}
the error is fired on the second NSLog
children() is a method of my LKRegion class, extending
EOEnterpriseObject, generated from EOModeler, to manage the table
LK_LOCATION in my db.
children is not a field, but the result of a to many relation from
LK_LOCATION to LK_LOCATION, and the method return a NSArray.
I have the feeling that the problem is show in this log, but I
really don't understand why the Object : CHILDREN:
com.webobjects.eocontrol._EOCheapCopyMutableArray[ddeda2] should
causes an error while calling editingContext();
CHILDREN: ({values = {className = "class
com.gestweb.locationkit.LKRegion"; images = "<
com.webobjects.eocontrol._EOCheapCopyMutableArray 1b0caf
(<EOAccessArrayFaultHandler images _EOIntegralKeyGlobalID[LKRegion
(java.lang.Integer)1000448]>)>"; modificationDate = 2006-11-17
15:40:26 Etc/GMT; name = "Regions"; creationDate = 2006-11-17
13:56:49 Etc/GMT; children = "<
com.webobjects.eocontrol._EOCheapCopyMutableArray ddeda2
(<EOAccessArrayFaultHandler children _EOIntegralKeyGlobalID
[LKRegion (java.lang.Integer)1000448]>)>"; parent =
"<com.gestweb.locationkit.LKCountry e80317 _EOIntegralKeyGlobalID
[LKCountry (java.lang.Integer)1000313]>"; }; this =
"<com.gestweb.locationkit.LKRegion e5d007 _EOIntegralKeyGlobalID
[LKRegion (java.lang.Integer)1000448]>"; })
editingContext: com.webobjects.eocontrol.EOEditingContext@6c9f0f
Session.default: com.webobjects.eocontrol.EOEditingContext@6c9f0f
Child: com.webobjects.eocontrol.EOEditingContext@6c9f0f
CHILDREN: com.webobjects.eocontrol._EOCheapCopyMutableArray [ddeda2]
editingContext: com.webobjects.eocontrol.EOEditingContext@6c9f0f
Session.default: com.webobjects.eocontrol.EOEditingContext@6c9f0f
[2006-11-17 16:40:26 CET] <WorkerThread4>
<com.webobjects.appserver._private.WOComponentRequestHandler >:
Exception occurred while handling request:
java.lang.IllegalStateException: sqlStringForKeyValueQualifier:
attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier
(_eofInv_LKRegion_children.className = 'class
com.gestweb.locationkit.LKRegion') failed because attribute
identified by key '_eofInv_LKRegion_children.className' was not
reachable from from entity 'AFProperty'
[2006-11-17 16:40:26 CET] <WorkerThread4>
java.lang.IllegalStateException : sqlStringForKeyValueQualifier:
attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier
(_eofInv_LKRegion_children.className = 'class
com.gestweb.locationkit.LKRegion') failed because attribute
identified by key '_eofInv_LKRegion_children.className' was not
reachable from from entity 'AFProperty'
at com.webobjects.jdbcadaptor.FrontbasePlugIn
$FrontbaseExpression.sqlStringForKeyValueQualifier
(FrontbasePlugIn.java:1016)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$_KeyValueQualifierSupport.sqlStringForSQLExpression
(EOQualifierSQLGeneration.java:441)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:151)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForArrayOfQualifiers
(EOSQLExpression.java:1562)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForConjoinedQualifier
s(EOSQLExpression.java:1597)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$_AndQualifierSupport.sqlStringForSQLExpression
(EOQualifierSQLGeneration.java:512)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:151)
at
com.webobjects.eoaccess.EOSQLExpression.prepareSelectExpressionWithAtt
ributes (EOSQLExpression.java:1024)
at
com.webobjects.jdbcadaptor.JDBCExpression.prepareSelectExpressionWithA
ttributes(JDBCExpression.java:273)
at
com.webobjects.eoaccess.EOSQLExpressionFactory.selectStatementForAttri
butes (EOSQLExpressionFactory.java:226)
at com.webobjects.jdbcadaptor.JDBCChannel.selectAttributes
(JDBCChannel.java:178)
at
com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificatio
nEditingContext(EODatabaseChannel.java :878)
at
com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificatio
nEditingContext(EODatabaseChannel.java:805)
at
com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecif
ication(EODatabaseChannel.java :215)
at
com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificati
onEditingContext(EODatabaseContext.java:3205)
at
com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecificatio
n(EODatabaseContext.java :3346)
at
com.webobjects.eoaccess.EODatabaseContext._followToManyRelationshipWit
hFetchSpecification(EODatabaseContext.java:2653)
at
com.webobjects.eoaccess.EODatabaseContext._followFetchSpecification
(EODatabaseContext.java :2807)
at
com.webobjects.eoaccess.EODatabaseContext._batchFetchRelationshipForSo
urceObjectsEditingContext(EODatabaseContext.java:3904)
at
com.webobjects.eoaccess.EODatabaseContext.objectsForSourceGlobalID
(EODatabaseContext.java :4187)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsForSourceGlob
alID(EOObjectStoreCoordinator.java:682)
at
com.webobjects.eocontrol.EOEditingContext.objectsForSourceGlobalID
(EOEditingContext.java:3965)
at com.webobjects.eoaccess.EODatabaseContext._fireArrayFault
(EODatabaseContext.java:4427)
at
com.webobjects.eoaccess.EOAccessArrayFaultHandler.completeInitializati
onOfObject(EOAccessArrayFaultHandler.java:70)
at com.webobjects.eocontrol._EOCheapCopyMutableArray.willRead
(_EOCheapCopyMutableArray.java:38)
at com.webobjects.eocontrol._EOCheapCopyMutableArray.count
(_EOCheapCopyMutableArray.java:92)
at com.webobjects.foundation.NSArray.lastObject (NSArray.java:833)
at com.gestweb.locationkit.LKRegion.childrenSortedByName
(LKRegion.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java :39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor
$1.methodValue (NSKeyValueCoding.java:684)
at com.webobjects.foundation.NSKeyValueCoding
$_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at com.webobjects.eocontrol.EOCustomObject.valueForKey
(EOCustomObject.java:1559)
at com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey
(NSKeyValueCoding.java:498)
at com.webobjects.foundation.NSKeyValueCodingAdditions
$DefaultImplementation.valueForKeyPath
(NSKeyValueCodingAdditions.java :212)
at com.webobjects.eocontrol.EOCustomObject.valueForKeyPath
(EOCustomObject.java:1675)
at com.webobjects.foundation.NSKeyValueCodingAdditions
$Utility.valueForKeyPath(NSKeyValueCodingAdditions.java:149)
at com.webobjects.foundation.NSKeyValueCodingAdditions
$DefaultImplementation.valueForKeyPath
(NSKeyValueCodingAdditions.java:217)
at com.webobjects.appserver.WOComponent.valueForKeyPath
(WOComponent.java:1600)
at
com.webobjects.appserver._private.WOKeyValueAssociation.valueInCompone
nt (WOKeyValueAssociation.java:46)
at com.webobjects.appserver.WOComponent.valueForBinding
(WOComponent.java:735)
at
com.webobjects.appserver._private.WOBindingNameAssociation.valueInComp
onent(WOBindingNameAssociation.java :35)
at com.webobjects.appserver.WOComponent.valueForBinding
(WOComponent.java:735)
at
com.webobjects.appserver._private.WOBindingNameAssociation.valueInComp
onent(WOBindingNameAssociation.java:35)
at com.webobjects.appserver.WOComponent.valueForBinding
(WOComponent.java:735)
at
com.webobjects.appserver._private.WOBindingNameAssociation.valueInComp
onent(WOBindingNameAssociation.java:35)
at com.webobjects.appserver.WOComponent.valueForBinding
(WOComponent.java:735)
at
com.webobjects.appserver._private.WOBindingNameAssociation.valueInComp
onent(WOBindingNameAssociation.java:35)
at com.webobjects.appserver.WOAssociation.booleanValueInComponent
(WOAssociation.java:278)
at
com.webobjects.appserver._private.WOConditional.takeValuesFromRequest
(WOConditional.java:33)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java :89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java:97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest (WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WORepetition.takeValuesFromRequest
(WORepetition.java:124)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java:97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest (WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WOConditional.takeValuesFromRequest(
WOConditional.java :41)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WOConditional.takeValuesFromRequest(
WOConditional.java:41)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java :97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WORepetition.takeValuesFromRequest
(WORepetition.java:124)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java :97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java:97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest (WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WOComponentContent.takeValuesFromReq
uest(WOComponentContent.java :20)
at
com.webobjects.appserver._private.WOComponentContent.takeValuesFromReq
uest(WOComponentContent.java:20)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest (WOComponentReference.java:97)
at
com.webobjects.appserver._private.WOSwitchComponent.takeValuesFromRequ
est(WOSwitchComponent.java:144)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java :914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromR
equest(WOComponentReference.java:97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFro
mRequest(WODynamicGroup.java :81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest
(WODynamicGroup.java:89)
at com.webobjects.appserver.WOComponent.takeValuesFromRequest
(WOComponent.java:914)
at com.webobjects.appserver.WOSession.takeValuesFromRequest
(WOSession.java:1139)
at affittiV2Admin.Session.takeValuesFromRequest(Session.java:331)
at com.webobjects.appserver.WOApplication.takeValuesFromRequest
(WOApplication.java:1350)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW
ithPreparedPage (WOComponentRequestHandler.java:189)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW
ithPreparedSession(WOComponentRequestHandler.java:287)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW
ithPreparedApplication (WOComponentRequestHandler.java:322)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleReq
uest(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleRequ
est (WOComponentRequestHandler.java:432)
at com.webobjects.appserver.WOApplication.dispatchRequest
(WOApplication.java:1306)
at com.webobjects.appserver._private.WOWorkerThread.runOnce
(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run
(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:613)
Any advice?
Thank you for your time
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden