Java – what is the attributeoverride annotation used in Hibernate

@Entity
@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;
}

I want to know the purpose of attributeoverride This is the code from hibernate online documentation

Solution

It is used to specify another name for the column in the table instead of the name specified in the embedded class

For example

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>