我有一个组织类如下
@Entity
@Table(name = "org")
public class Organization implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String orgname;
我正在尝试将Org表链接到userorg表。 两者之间的联系是,userorg表引用orgid。
@Entity
@Table(name = "user_org")
public class UserOrganization implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private long userid;
private long orgid;
@OneToOne(cascade=CascadeType.ALL)
@JoinTable(name="user_organizationList",joinColumns={@JoinColumn(name="orgid", referencedColumnName="id")})
private Organization orgData;
orgData始终为null。
任何人都可以帮我建立这个联接