@Entity
class User {
@EmbeddedId
@AttributeOverride(name="firstName", column=@Column(name="fld_firstname")
UserId id;
Integer age;
}
@Embeddable
class UserId implements Serializable {
String firstName;
String lastName;
}

我想知道AttributeOverride的用途。
这是来自休眠在线文档的代码

最佳答案

它用于为表中的列指定另一个名称,而不是您的嵌入式类中指定的名称。

例如。

07-24 02:04