Re: EO mixing up flattened relationships?

Anders Peterson <[email protected]> Tue, 20 Jul 2004 18:19:27 +0200
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Thanks, but in my case everything is in one database and one eomodel.  
Anders

On 2004-07-20, at 17.52, Lenny Marks wrote:

> Is this a flattended relationship accross models connected to  
> different databases? There is a bug in EOF where it ignores the fact  
> that there are multiple databases involved when generating the SQL for  
> such relationships. If you set EOAdaptorDebugEnabled=true, you would  
> see that the SQL is querying against only one database.  This could  
> cause a lot of confusion(as it did for us) if the same schemas exist  
> in both databases.
>
> http://www.omnigroup.com/mailman/archive/webobjects-dev/2003-June/ 
> 034283.html
>
> -lenny
>
> On Tuesday, Jul 20, 2004, at 04:16 America/New_York, Anders Peterson  
> wrote:
>
>> On 2004-07-19, at 21.44, Chuck Hill wrote:
>>
>> Hi Chuck and thanks for trying to help,
>>
>>> Perhaps you are misinterpreting this error.
>>> What it usually means, in my experience, is that some other process  
>>> has deleted the target object (row) after this process has read the  
>>> foreign key for it.  That would explain why you can't find the row.
>>
>> I am certain that no EOs have been created or deleted between app  
>> startup and exception. Reproducing this situation is straight  
>> forward.
>>
>> At first I thought that I had defined some eo-relationship or a  
>> database view incorrectly. Perhaps I have, but I spent many hours  
>> looking for such an error and found nothing.
>>
>> Then I remembered I had a similar problem before. (Apple Bug Reporter  
>> Problem ID:  2872983)
>>
>> In that case I had vertical inheritance mapping with a to-one  
>> relationship defined in an abstract parent class, I could confirm  
>> that all necessary attributes where not fetched from the database.  
>> Later on, when one of the not-fetched attributes was needed EOF  
>> simply took one of the other ones. (I assume I also had some  
>> flattened relationship.)
>>
>> At that time I got rid of the problem by switching to horizontal  
>> inheritance mapping. Too late for testing Apple informed me that "In  
>> particular, any foreign key that is used in the relationship used for  
>> flattening inherited attributes and relationship must be used for  
>> locking."
>>
>>
>> This time I'm using single table inheritance mapping, and I've made  
>> certain I lock on all attributes used to flatten any relationship...
>>
>>
>> One more thing: This only seems to be a problem when fetching data  
>> using a WODisplayGroup.
>>
>> /Anders
>>
>>> On Jul 19, 2004, at 11:16 AM, Anders Peterson wrote:
>>>
>>>> Hi,
>>>>
>>>> "The object with globalID _EOIntegralKeyGlobalID[QInstrument  
>>>> (java.lang.Integer)307183] could not be found in the database."
>>>>
>>>> There is only one primary key in the database (any table) that  
>>>> equals 307183, and it is not in a table associated with  
>>>> QInstrument.
>>>>
>>>> CurrentChange and CurrentHolding are views returning subsets of the  
>>>> tables Change and Holding.
>>>>
>>>> Instrument is an abstract superclass with two children - fund and  
>>>> security. (Single table inheritance.)
>>>>
>>>> The 'fund' relationship in CurrentChange is a flattened  
>>>> relationship defined as 'currentHolding.instrument'.
>>>>
>>>> How can I find out where/why/how the incorrect GID is created?
>>>>
>>>> /Anders
>>>>
>>>> 115887 [WorkerThread0] DEBUG NSLog  -  === Begin Internal  
>>>> Transaction
>>>> 115890 [WorkerThread0] DEBUG NSLog  -  evaluateExpression:  
>>>> <com.webobjects.jdbcadaptor.SybasePlugIn$SybaseExpression: "SELECT  
>>>> t0.communication_id, t0.holding_id, t0.change_id FROM  
>>>> QGroup.QsdCurrentChange t0, QGroup.QsdCurrentHolding T1,  
>>>> QGroup.QsdInstrument T2 WHERE T2.instrument_id = ? AND  
>>>> t0.holding_id = T1.holding_id AND T1.instrument_id =  
>>>> T2.instrument_id" withBindings: 1:10274(id)>
>>>> 116149 [WorkerThread0] DEBUG NSLog  - 761 row(s) processed
>>>> 116157 [WorkerThread0] DEBUG NSLog  -  === Commit Internal  
>>>> Transaction
>>>> 117590 [WorkerThread0] DEBUG NSLog  -  === Begin Internal  
>>>> Transaction
>>>> 117597 [WorkerThread0] DEBUG NSLog  -  evaluateExpression:  
>>>> <com.webobjects.jdbcadaptor.SybasePlugIn$SybaseExpression: "SELECT  
>>>> t0.category, t0.tmp_current_value, t0.expected_return,  
>>>> t0.expected_variance, t0.tmp_export_change, t0.external_key,  
>>>> t0.instrument_id, t0.locked, t0.measured_return,  
>>>> t0.measured_variance, t0.name, RTRIM(t0.portrayal), t0.tagged,  
>>>> t0.type FROM QGroup.QsdInstrument t0 WHERE ((t0.type = ? OR t0.type  
>>>> = ?) AND t0.instrument_id = ?)" withBindings: 1:"O"(type),  
>>>> 2:"L"(type), 3:307183(id)>
>>>> 117647 [WorkerThread0] DEBUG NSLog  - 0 row(s) processed
>>>> 117649 [WorkerThread0] DEBUG NSLog  -  === Commit Internal  
>>>> Transaction
>>>> 134866 [WorkerThread0] WARN NSLog  -  
>>>> <com.webobjects.appserver._private.WOComponentRequestHandler>:  
>>>> Exception occurred while handling request:
>>>> java.lang.IllegalStateException: The object with globalID  
>>>> _EOIntegralKeyGlobalID[QInstrument (java.lang.Integer)307183] could  
>>>> not be found in the database. This could be result of a referential  
>>>> integrity problem with the database. An empty fault could not be  
>>>> created because the object's class could not be determined (e.g.  
>>>> the GID is temporary or it is for an abstract entity).
>>>> 134880 [WorkerThread0] INFO NSLog  -
>>>> 134881 [WorkerThread0] INFO NSLog  - ### Begin Problem Report ###
>>>> 134882 [WorkerThread0] INFO NSLog  - 2004-07-19 16:46:54 Etc/GMT
>>>> 134882 [WorkerThread0] INFO NSLog  - Victim: QsdOptApp
>>>> 134882 [WorkerThread0] INFO NSLog  - Problem:  
>>>> java.lang.IllegalStateException: The object with globalID  
>>>> _EOIntegralKeyGlobalID[QInstrument (java.lang.Integer)307183] could  
>>>> not be found in the database. This could be result of a referential  
>>>> integrity problem with the database. An empty fault could not be  
>>>> created because the object's class could not be determined (e.g.  
>>>> the GID is temporary or it is for an abstract entity).
>>>> 134883 [WorkerThread0] INFO NSLog  -
>>>> 134886 [WorkerThread0] INFO NSLog  -  
>>>> java.lang.IllegalStateException: The object with globalID  
>>>> _EOIntegralKeyGlobalID[QInstrument (java.lang.Integer)307183] could  
>>>> not be found in the database. This could be result of a referential  
>>>> integrity problem with the database. An empty fault could not be  
>>>> created because the object's class could not be determined (e.g.  
>>>> the GID is temporary or it is for an abstract entity).
>>>> 	at  
>>>> com.webobjects.eoaccess.EODatabaseContext._fetchSingleObject(EODatab 
>>>> aseContext.java:3574)
>>>> 	at  
>>>> com.webobjects.eoaccess.EODatabaseContext._objectFaultWithSnapshotRe 
>>>> lationshipEditingContext(EODatabaseContext.java:2533)
>>>> 	at  
>>>> com.webobjects.eoaccess.EODatabaseContext._fireDeferredFaultWithSour 
>>>> ceObject(EODatabaseContext.java:2576)
>>>> 	at  
>>>> com.webobjects.eoaccess.EOAccessDeferredFaultHandler.createFaultForD 
>>>> eferredFault(EOAccessDeferredFaultHandler.java:45)
>>>> 	at  
>>>> com.webobjects.eocontrol.EOCustomObject.willReadRelationship(EOCusto 
>>>> mObject.java:1302)
>>>> 	at  
>>>> com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_L 
>>>> azyGenericRecordBinding.valueInObject(_EOMutableKnownKeyDictionary.j 
>>>> ava:560)
>>>> 	at  
>>>> com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomOb 
>>>> ject.java:1736)
>>>> 	at  
>>>> se.optimatika.proj.qsd.eo.QCDCurrentChange.getFund(QCDCurrentChange. 
>>>> java:185)
>>>>
>>>> _______________________________________________
>>>> WebObjects-dev mailing list
>>>> [email protected]
>>>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>>>
>>
>> _______________________________________________
>> WebObjects-dev mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>