Day02:

  • 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;

你可能感兴趣的:(Day02:)