java 什么是 AttributeOverride 注释用于 Hibernate
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5260992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 10:17:37 来源:igfitidea点击:
what is AttributeOverride annotation used for in Hibernate
提问by xxtommoxx
@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 what is the use of AttributeOverride. This is the code from hibernate online docs
我想知道AttributeOverride有什么用。这是来自 hibernate 在线文档的代码
回答by xxtommoxx
It is for specifying another name for the column in the table other than the one specified in your embedded class.
它用于为表中的列指定另一个名称,而不是在嵌入类中指定的名称。
E.g.
例如