@JoinColumn name=cid是什么意思?
//一对多 双向关联 Student.java: @ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER) @JoinColumn(name = "cid") /// ???? private ClassRoom classRoom; ClassRoom.java @Id @GeneratedValue(generator = "cid") @GenericGenerator(name = "cid",strategy = "assigned") @Column(length = 4) private String cid; private String cname; @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name = "cid") /// ??? private Set<Student> stus;
请问cid指的是什么 ??? 这个cid指的是 生成的外键字段的名词 吗?
有没有要求必须要与主键cid属性同名?如果没有要求的换个其他比较好, 都叫cid这样会有歧义.
还有双向关联双方实体类 @JoinColumn name="xxx" 是都需要写一样吗?