0

이것은 내 코어 데이터 데이터베이스의 데이터 모델입니다.코어 데이터를 사용하여 두 엔티티를 하나로 결합합니다.

이제 모든 ICD9 개체 (질병과 프로 시저 모두)를 가져와야합니다. 두 엔티티를 검색하기 위해 가져 오기를 설정할 수 없으므로이를 두 개의 개별 객체 대신 하나의 ICD9 객체로 병합 할 수있는 방법이 있습니까?

enter image description here

업데이트 모델 :

enter image description here

오류 메시지 :

Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x12ed7300 {metadata=<CFBasicHash 0x12ed5d20 [0x2f6eb38]>{type = immutable dict, count = 7, 
entries => 
    2 : <CFString 0x12ed45b0 [0x2f6eb38]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x12ed4d80 [0x2f6eb38]>{type = immutable, count = 1, values = (
    0 : <CFString 0x2f69cd8 [0x2f6eb38]>{contents = ""} 
)} 
    4 : <CFString 0x12ed4740 [0x2f6eb38]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x12ed4da0 [0x2f6eb38]>{value = +320, type = kCFNumberSInt64Type} 
    6 : <CFString 0x12ed48d0 [0x2f6eb38]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x12ed53c0 [0x2f6eb38]>{type = immutable dict, count = 5, 
entries => 
    0 : <CFString 0x12ed4c10 [0x2f6eb38]>{contents = "CPT"} = <CFData 0x12f7ce50 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0xbadc4637a7c1885cd19a176755d1fecf ... 29f23ba15836dff2} 
    1 : <CFString 0x12ed4f10 [0x2f6eb38]>{contents = "ICD9Disease"} = <CFData 0x12f7cea0 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x7cf87b9141b2c154fda8fa973b11aba4 ... 471f47adf2a60a63} 
    2 : <CFString 0x12ed50a0 [0x2f6eb38]>{contents = "ICD9Procedure"} = <CFData 0x12f7d040 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x05909fa15f0da3d0d9a4329e31da816a ... fe44e8c0de14354b} 
    3 : <CFString 0x12ed5230 [0x2f6eb38]>{contents = "MedicalCode"} = <CFData 0x12f7d090 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x7d1d70878edb9c839f9586011ad1726f ... e7a60fcde779e490} 
    6 : <CFString 0x12ed5250 [0x2f6eb38]>{contents = "HCPCS"} = <CFData 0x12f7d0e0 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x9d052e1525b4357a1cd9b6c1d6481bbf ... 7ef40429b86137c0} 
} 

    7 : <CFString 0x1a16aa8 [0x2f6eb38]>{contents = "NSStoreUUID"} = <CFString 0x12ed3f70 [0x2f6eb38]>{contents = "EC3CEFE5-2414-431F-ABCE-C67DE6471874"} 
    8 : <CFString 0x1a16948 [0x2f6eb38]>{contents = "NSStoreType"} = <CFString 0x1a16958 [0x2f6eb38]>{contents = "SQLite"} 
    9 : <CFString 0x12ed4a60 [0x2f6eb38]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0xb8283f0 [0x2f6eb38]>{value = +3, type = kCFNumberSInt32Type} 
    10 : <CFString 0x12ed4bf0 [0x2f6eb38]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x12ed5570 [0x2f6eb38]>{contents = "2"} 
} 
, reason=The model used to open the store is incompatible with the one used to create the store}, { 
    metadata =  { 
     NSPersistenceFrameworkVersion = 320; 
     NSStoreModelVersionHashes =   { 
      CPT = <badc4637 a7c1885c d19a1767 55d1fecf de75bb71 1198e89c 29f23ba1 5836dff2>; 
      HCPCS = <9d052e15 25b4357a 1cd9b6c1 d6481bbf 3ee5bbef 7d67313a 7ef40429 b86137c0>; 
      ICD9Disease = <7cf87b91 41b2c154 fda8fa97 3b11aba4 49984cd5 b8b4694e 471f47ad f2a60a63>; 
      ICD9Procedure = <05909fa1 5f0da3d0 d9a4329e 31da816a 0f76d10e 54122f9c fe44e8c0 de14354b>; 
      MedicalCode = <7d1d7087 8edb9c83 9f958601 1ad1726f 0ced7e49 2a139a20 e7a60fcd e779e490>; 
     }; 
     NSStoreModelVersionHashesVersion = 3; 
     NSStoreModelVersionIdentifiers =   (
      "" 
     ); 
     NSStoreType = SQLite; 
     NSStoreUUID = "EC3CEFE5-2414-431F-ABCE-C67DE6471874"; 
     "_NSAutoVacuumLevel" = 2; 
    }; 
    reason = "The model used to open the store is incompatible with the one used to create the store"; 
} 
+0

안녕하세요 저는이 데이터 모델을 인식하고 있습니다. 'MedicalCode'에서 내려온 'ICD9'라는 또 다른 추상 엔티티를 만들 수 있습니다. 그렇다면'ICD9Disease'와'ICD9Procedure'는 구체적인 서브 클래스가 될 것이다. 공통 속성을 추상 'ICD9' 클래스로 옮기십시오. –

+0

안녕하세요 아담;). 위 모델의 새로운 그림을 추가했습니다. 좋아 보이니? – Jon

+0

네, 그건 상상했던 것입니다. 이제 모든 'ICD9'개체에 대한 가져 오기 요청을 수행하고 질병과 절차를 모두받을 수 있습니다. –

답변

2

당신은 다른 추상적 인 실체 MedicalCode에서 내려 ICD9라는 만들 수 있습니다. 그러면 ICD9DiseaseICD9Procedure은 구체적인 하위 클래스가됩니다. 공통 속성을 추상 ICD9 클래스로 이동하십시오.

이제 모든 ICD9 엔티티에 대해 가져 오기 요청을 수행하고 두 하위 엔티티를 모두받을 수 있습니다.

+0

안녕하세요. 마크, 저는 실제로 새로운 변화로 인해 충돌합니다. 나는 시뮬레이터를 재설정하고, 빌드를 청소하지만, 행운을 빌려 애플 리케이션을 삭제하려고했습니다. 질문에 오류 메시지를 게시했습니다. – Jon

+0

데이터 모델의 새 버전을 만들지 않았기 때문입니까? 오히려 방금 새 클래스 ICD9 객체를 기존 클래스에 추가하고 객체 클래스를 다시 생성 했습니까? – Jon

+0

크래시로 질문을 업데이트 할 수 있습니까? 예외가 있습니까? –

0

이전 모델에서 생성 된 데이터 저장소를 삭제 해보십시오. 도서관 디렉토리에서 신청할 가능성이 높습니다. 프로그램을 다시 실행할 때 오류없이 저장소를 다시 만들어야합니다.

관련 문제