Consider two Entity Employee and Address. Class Address { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column private String id; @Column (name = "name") private String name; //with corresponding getters and setters } Class VehicleOwner { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column private String id; @Column(name = "brandname" private String brandName; @Column (name = "ownerame") private String ownerName; //with corresponding getters and setters } To have a join between Employee name and CarOwner name, add @JoinColumn annotation as follow. @OneToOne @JoinColumn(name = "name", referencedColumnName = "ownername") private VehicleOwner vehicleOwner;
Join between Non-Primary Key of One Entiry and Non-Primary Key of other Entity
Join between Non-Primary Key of One Entiry and Non-Primary Key of other Entity
Team Building Chitwan 2011
Posted by
Pratik Hada
Thursday, December 1, 2011
0
comments
Labels:
Chitwan National Park,
VIT team Building