티스토리 뷰
1. Embedded를 활용한 복합키
@Entity
@Table(name = "some_entity")
public class SomeEntity {
@EmbeddedId
private SomeId id;
private String name;
}
@Embeddable
public class SomeId {
private Long someNumer;
private Long someString;
}
2. IdClass를 활용한 복합키
@Entity
@IdClass(OtherId.class)
@Table(name = "other_entity")
public class OtherEntity {
@Id
private Long otherNumer;
@Id
private Long otherString;
private String name;
}
public class OtherId {
@Id
private Long otherNumer;
@Id
private String otherString;
}
'Programming > JPA' 카테고리의 다른 글
Join Table (0) | 2019.05.31 |
---|---|
Basic Mapping (0) | 2019.05.30 |
Embedded Mapping (0) | 2019.05.29 |
Discriminate Mapping (0) | 2019.05.26 |
Query DSL, Criteria 설정 (0) | 2019.03.01 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- java generic
- Charles proxy
- Discriminate Mapping
- Join Table
- DI
- java Equals
- java EqualsAndHashCode
- JPA
- SmartLifecycle
- Spring
- Criteria
- JPA Criteria
- Embeddable Mapping
- Spring Registrar
- Registrar
- Typesafe Config
- docker
- guava
- Mapping
- Sprint RetryTemplate
- @Primary
- Property
- 복합키 Mapping
- scikit-learn
- Akka
- Embedded Mapping
- Spring JDBC Template
- spring spel
- RetryTemplate
- Query DSL
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함