====== @Embeddable / @Embedded ======
* [[https://en.wikibooks.org/wiki/Java_Persistence/Embeddables|JPA Embeddables]]
===== @Embeddable =====
@Embeddable
public class EmploymentPeriod {
@Column(name="START_DATE")
private java.sql.Date startDate;
@Column(name="END_DATE")
private java.sql.Date endDate;
....
}
===== @Embedded =====
@Embedded
private EmploymentPeriod period;
// or
@Embedded
@AttributeOverrides({
@AttributeOverride(name="startDate", column=@Column(name="START_DATE")),
@AttributeOverride(name="endDate", column=@Column(name="END_DATE"))
})
private Period employmentPeriod;
==== 참고 ====
* [[http://in.relation.to/2015/07/23/advanced-embeddable-mappings/|Map me if you can - Advanced embeddable mappings]]