728x90
@AssocicationOverride
@MappedSuperclass๋ฅผ ํตํด ์์ ๋ฐ์ ๊ฒฝ์ฐ๋ @Embedded๋ฅผ ํตํด ์์๋ฐ์ ํ๋ ์ค,
์ฐ๊ด๊ด๊ณ๋ฅผ ์ฌ์ ์ํ์ฌ ์ฌ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ์ ์ฌ์ฉํฉ๋๋ค.
@AssocicationOverride ํน์ @AssocicationOverrides๋ฅผ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ, ์ฌ์ฉ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
@AssociationOverride(name="๋ถ๋ชจ ํ๋๋ช ", joinColumns=@JoinColumn(name="์ฌ์ ์ํ FK ์ปฌ๋ผ๋ช "))
@MappedSuperclass
public class Employee {
...
@ManyToOne
protected Address address;
...
}
@Entity
@AssociationOverride(name="address", joinColumns=@JoinColumn(name="ADDR_ID"))
// address field mapping overridden to ADDR_ID foreign key
public class PartTimeEmployee extends Employee {
...
}
Reference
[์๋ฐ ORM ํ์ค JPA ํ๋ก๊ทธ๋๋ฐ - ๊น์ํ]
728x90
'๐๏ธ Spring > JPA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JPA] ์ฆ์ ๋ก๋ฉ๊ณผ ์ง์ฐ ๋ก๋ฉ ( + PersistentBag) (0) | 2021.12.15 |
---|---|
[JPA] JPA์์์ ํ๋ก์ (0) | 2021.12.15 |
[JPA] ํ๋์ ์ปฌ๋ผ ๋งคํ - @Embedded (์๋ฒ ๋๋ ํ์ ๋งคํ) (0) | 2021.12.15 |
[JPA] @MappedSuperclass (0) | 2021.12.15 |
[JPA] ์์๊ด๊ณ ๋งคํํ๋ ๋ฐฉ๋ฒ (0) | 2021.12.15 |