这是映射信息的一部分:
id:
type: integer
id: true
generator:
strategy: AUTO
ms_id:
type: string
unique: true
oneToOne:
parent:
targetEntity: Category
nullable: true
如何与ms_id建立连接而不是id
答案 0 :(得分:1)
您可以使用 referencedColumnName 指定连接列参数, 请参阅association mapping document
id:
type: integer
id: true
generator:
strategy: AUTO
ms_id:
type: string
unique: true
oneToOne:
parent:
targetEntity: Category
joinColumn:
name: category_id
referencedColumnName: ms_id
nullable: true