fahrurben
5/12/2018 - 3:15 AM

JPA Many to one

@Entity
public class Phone {
  @Id
  private long id;
  ...
  // Specifies the PHONE table does not contain an owner column, but 
  // an OWNER_ID column with a foreign key. And creates a join to
  // lazily fetch the owner
  @ManyToOne(fetch=FetchType.LAZY)
  @JoinColumn(name="OWNER_ID")
  private Employee owner;
  ...
}