리포지토리
-
엔터프라이즈 애플리케이션 아키텍처 패턴 2 - 객체&관계형 매핑, 리포지토리, 프런트 컨트롤러책책책 책을 읽읍시다/프로그래밍 2023. 3. 13. 23:48
12장 객체-관계형 구조 패턴 : 식별자 필드 관계형 데이터베이스는 행을 다른 행과 구분하기 위해 기본 키라고 하는 키를 사용한다. 그러나 객체 시스템은 내부적으로 올바른 식별자를 보장하므로 인메모리 객체에는 이러한 키가 필요없다(C++의 경우 원시 메모리 위치를 활용함). 데이터베이스에서 데이터를 읽는 것은 간단하지만 데이터를 다시 기록하려면 데이터베이스와 인메모리 객체 시스템을 연결해야 한다. 식별자 필드(Identity Field)는 기본적으로 놀라울 만큼 단순하다. 관계형 데이터베이스의 기본 키를 객체의 필드에 저장하는 것이 전부다. 식별자 필드의 기본 개념은 아주 간단하지만 상당히 많은 복잡한 사항이 연관돼 있다. 키 선택 : 첫 번째 문제는 데이터베이스에 있는 어떤 종류의 키를 선택하느냐다. ..