티스토리 뷰
Table의 column을 Object로 Mapping할 때 사용한다.
- table: some_codes
column: someCodeId | description | code1 | name1 | code2 | name2 | code3 | name3
@Entity
@Table(name = "some_codes")
public class SomeCode {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long someCodeId;
private String description;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "code", column = @Column(name = "code1")),
@AttributeOverride(name = "name", column = @Column(name = "name1"))
})
private CodeSection someSection1;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "code", column = @Column(name = "code2")),
@AttributeOverride(name = "name", column = @Column(name = "name2"))
})
private CodeSection someSection2;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "code", column = @Column(name = "code3")),
@AttributeOverride(name = "name", column = @Column(name = "name3"))
})
private CodeSection someSection3;
}
@Embeddable
public class CodeSection {
@Basic
private String code;
@Basic
private String name;
}
'Programming > JPA' 카테고리의 다른 글
복합키 Mapping (0) | 2019.05.30 |
---|---|
Basic Mapping (0) | 2019.05.30 |
Discriminate Mapping (0) | 2019.05.26 |
Query DSL, Criteria 설정 (0) | 2019.03.01 |
Query DSL (0) | 2018.08.05 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Spring
- Akka
- docker
- Spring JDBC Template
- Registrar
- Join Table
- Property
- DI
- 복합키 Mapping
- Mapping
- java Equals
- Embedded Mapping
- Sprint RetryTemplate
- Spring Registrar
- JPA Criteria
- spring spel
- java EqualsAndHashCode
- SmartLifecycle
- scikit-learn
- Discriminate Mapping
- Query DSL
- RetryTemplate
- Typesafe Config
- java generic
- Charles proxy
- JPA
- @Primary
- guava
- Embeddable Mapping
- Criteria
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함