Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- @ConfigurationProperties
- JsonSerializer
- EnableAutoConfiguration
- HttpMessageConverters
- 리소스 서버
- 백기선
- WebApplication Type
- application.properties
- 백준
- 정적 리소스
- AuthenticationPrincipal
- Spring Security
- Application Runner
- 브루트포스
- OAuth2
- @Profile
- Application Argument
- cors
- 백트래킹
- 리소스핸들러
- webjar
- JPA
- rest api
- 외부설정
- 스프링 부트
- HATEOAS
- Application Event
- 알고리즘
- 스프링부트
- 다익스트라
Archives
- Today
- Total
아카이브
[스프링 데이터 JPA] JPA 프로그래밍 3. Value 타입 맵핑 본문
엔티티 타입과 Value 타입 구분
- 식별자가 있어야 하는가 (Account 도메인 클래스)
- 독립적으로 존재해야 하는가 (Address Composite Value 클래스)
Value 타입 종류
다른 타입에 종속적인 타입을 Value 타입이라고 보면 됨 (Address 클래스는 Account 도메인 클래스에 종속적이다.)
- 기본 타입 (String, Date, Boolean,...)
- Composite Value 타입
- Collection Value 타입
- 기본 타입의 컬렉션
- 컴포짓 타입의 컬렉션
Composite Value 타입 맵핑
- @Embadable: Composite Value 클래스에 지정하면 해당 클래스를 Composite Value로 만듦
- @Embadded: Entity에서 Composite Value로 지정한 클래스를 불러와 정의할 때 사용
- @AttributeOverrides: 여러 값을 오버 라이딩하기위한 그룹 어노테이션
- @AttributeOverride: 오버라이딩 하기 위해 사용
Address Composite Value 클래스
@Embeddable
public class Address {
private String street;
private String city;
private String state;
private String zipCode;
}
Account 도메인 클래스에서 Composite Value 클래스 로딩
@Embedded
@AttributeOverrides({
@AttributeOverride(name="street", column = @Column(name="home_street"))
})
private Address address;
'Spring > 스프링 데이터 JPA' 카테고리의 다른 글
[스프링 데이터 JPA] JPA 프로그래밍 5. Cascade (0) | 2021.01.10 |
---|---|
[스프링 데이터 JPA] JPA 프로그래밍 4. 1대다(관계) 맵핑 (0) | 2021.01.10 |
[스프링 데이터 JPA] JPA 프로그래밍 2. 엔티티 타입 맵핑 (0) | 2021.01.10 |
[스프링 데이터 JPA] JPA프로그래밍 1. 프로젝트 셋팅 (0) | 2021.01.10 |
[스프링 데이터 JPA] ORM 패러다임 불일치 (0) | 2021.01.10 |