<many-to-one /> 和 <one-to-one />标签都有property-ref 属性,但是该属性在对应标签的含义是不一样的。
<many-to-one />标签中,property-ref 属性的官方解释:
property-ref (optional): the name of a property of the associated class that is joined to this foreign key.If not specified, the primary key of the associated class is used.
property-ref: (可选) 指定关联类的一个属性,这个属性将会和本外键相对应。 如果没有指定,会使用对方关联类的主键。
<one-to-one />标签中,property-ref 属性的官方解释:
property-ref (optional): the name of a property of the associated class that is joined to the primary keyof this class. If not specified, the primary key of the associated class is used.
property-ref: (可选) 指定关联类的属性名,这个属性将会和本类的主键相对应。如果没有指定,会使用对方关联类的主键。
注意红色部分的标注。仔细体会。