I have an issue that seems to be caused by creating a flattened relationship. I have four objects. A Diagram, Region, a DiagramRegion, and an Area. DiagramRegion has a to-one to diagram and region, and area has a to-one to DiagramRegion. So, I thought it would be useful to add a flattened to-one from the area to the diagram and another from the area to the region. However, doing either causes the following exception in the app. I'm not even using the flattened relationships yet, just adding them was enough to cause the problem. I'm pulling the relationships out, but I was wondering if anyone knew why this happens.
java.lang.IllegalArgumentException: Attempt to create an EOGlobalID for the entity "Diagram" with a primary key component of type com.webobjects.foundation.NSTimestamp instead of type java.math.BigDecimal!
at com.webobjects.eoaccess.EOEntity._coercePKInput(EOEntity.java:390)
at com.webobjects.eoaccess.EOEntity._validatePKTypes(EOEntity.java:422)
at com.webobjects.eoaccess.EOEntity._globalIDWithValues(EOEntity.java:439)
at com.webobjects.eoaccess.EOEntity._globalIDForRowIsFinal(EOEntity.java:2886)
at com.webobjects.eoaccess.EOEntity.globalIDForRow(EOEntity.java:1846)
at com.webobjects.eoaccess.EODatabaseContext._objectFaultWithSnapshotRelationshipEditingContext(EODatabaseContext.java:2355)
at com.webobjects.eoaccess.EODatabaseContext._fireDeferredFaultWithSourceObject(EODatabaseContext.java:2401)
at com.webobjects.eoaccess.EOAccessDeferredFaultHandler.createFaultForDeferredFault(EOAccessDeferredFaultHandler.java:49)
at com.webobjects.eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:1279)
at er.extensions.eof.ERXGenericRecord.willReadRelationship(ERXGenericRecord.java:400)
at com.webobjects.eocontrol.EOGenericRecord$_LazyDictionaryBinding.valueInObject(EOGenericRecord.java:280)
at er.extensions.eof.ERXGenericRecord$TouchingBinding.valueInObject(ERXGenericRecord.java:201)
at com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634)
at com.webobjects.eoaccess.EODatabaseContext.databaseOperationForObject(EODatabaseContext.java:4814)
at com.webobjects.eoaccess.EODatabaseContext.valuesForKeys(EODatabaseContext.java:6535)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.valuesForKeys(EOObjectStoreCoordinator.java:326)
at com.webobjects.eoaccess.EOQualifierSQLGeneration$_KeyValueQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:439)
at er.extensions.ERXExtensions$KeyValueQualifierSQLGenerationSupport.schemaBasedQualifierWithRootEntity(ERXExtensions.java:333)
at com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
at com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:227)
at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3055)
at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
at com.webobjects.eocontrol.EOSharedEditingContext.objectsWithFetchSpecification(EOSharedEditingContext.java:365)
at com.webobjects.eoaccess.EODatabaseContext.objectsForSourceGlobalID(EODatabaseContext.java:4084)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsForSourceGlobalID(EOObjectStoreCoordinator.java:634)
at com.webobjects.eocontrol.EOEditingContext.objectsForSourceGlobalID(EOEditingContext.java:3923)
at com.webobjects.eoaccess.EODatabaseContext._fireArrayFault(EODatabaseContext.java:4245)
at com.webobjects.eoaccess.EOAccessArrayFaultHandler.completeInitializationOfObject(EOAccessArrayFaultHandler.java:77)
at com.webobjects.eocontrol._EOCheapCopyMutableArray.willRead(_EOCheapCopyMutableArray.java:45)
at com.webobjects.eocontrol._EOCheapCopyMutableArray.count(_EOCheapCopyMutableArray.java:103)
... and so on...