View Javadoc
1   package myorg.relex.one2one;
2   
3   import java.util.Date;
4   import javax.persistence.*;
5   
6   /**
7    * This class provides an example initiation of cascade actions to a 
8    * related entity.
9    */
10  @Entity
11  @Table(name="RELATIONEX_LICAPP")
12  public class LicenseApplication {
13  	@Id @GeneratedValue
14  	private int id;
15  	@Temporal(TemporalType.TIMESTAMP)
16  	private Date updated;
17  	
18  	@OneToOne(optional=false, fetch=FetchType.EAGER, 
19  			cascade={
20  				CascadeType.PERSIST,
21  				CascadeType.DETACH,
22  				CascadeType.REMOVE,
23  				CascadeType.REFRESH,
24  				CascadeType.MERGE
25  			})
26  	private License license;
27  	
28  	public LicenseApplication() {}
29  	public LicenseApplication(License license) {
30  		this.license = license;
31  	}
32  	
33  	public int getId() { return id; }
34  	public License getLicense() { return license; }
35  
36  	public Date getUpdated() { return updated; }
37  	public void setUpdated(Date updated) {
38  		this.updated = updated;
39  	}
40  }