View Javadoc
1   package myorg.relex.one2one;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This class provides an example of the inverse side of a
7    * one-to-one bi-directional relationship.
8    */
9   @Entity
10  @Table(name="RELATIONEX_APPLICANT")
11  public class Applicant {
12  	@Id @GeneratedValue
13  	private int id;
14  	@Column(length=32)
15  	private String name;
16  
17  	@OneToOne(
18              mappedBy="applicant", //identifies property on owning side
19  			fetch=FetchType.LAZY)
20  //	@Transient
21  	private Application application;
22  
23  	public Applicant(){}
24  	public Applicant(int id) {
25  		this.id = id;
26  	}
27  	
28  	public int getId() { return id; }
29  
30  	public String getName() { return name; }
31  	public void setName(String name) {
32  		this.name = name;
33  	}
34  
35  	public Application getApplication() { return application; }
36  	public void setApplication(Application application) {
37  		this.application = application;
38  	}
39  }