I have a organization class as follows
@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;
I am trying to link Org table to from userorg table. The link between the two is , userorg table references 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;
The orgData is always null.
Can anyone please help me to establish this join