yl_suc
会上树的狼
采纳率50%
2015-10-07 10:21 阅读 2.9k

jpa中@JoinColumn使用出错

jpa中@JoinColumn使用出错。

Employee类代码:

 package com.yunkouan.jpatest;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class Employee {

    @Id
    private int id;

    private String name;

    @ManyToOne
    @JoinColumn(name="dept_id",referencedColumnName="id")
    private Department dept;
}

Department代码:

 package com.yunkouan.jpatest;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Department {

    @Id private int id;
    private String der_name;

}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐