Day02:

96
宇宙超人喵学长
2017.07.13 14:41* 字数 96
  • 1、内嵌类型

@Embeddable 描述映射类型本身
@Embedded 引用给定的可嵌入类型

一个Entity中映射多个相同的内嵌类型时,需要关联列名

@Embedded
@AttributeOverrides(
@AttributeOverride(
name = "line1",
column = @Column( name = "home_address_line1" ),
),
@AttributeOverride(
name = "line2",
column = @Column( name = "home_address_line2" )
),
@AttributeOverride(
name = "zipCode.postalCode",
column = @Column( name = "home_address_postal_cd" )
),
@AttributeOverride(
name = "zipCode.plus4",
column = @Column( name = "home_address_postal_plus4" )
)
)
private Address homeAddress;

Hibernate
Web note ad 1