View Javadoc
1   package myorg.relex.one2one;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This entity class provides an example of an entity that
7    * will get deleted when no longer referenced by its dependent
8    * entity in a one-to-one relation. This is called orphan removal.
9    */
10  @Entity
11  @Table(name="RELATIONEX_RESIDENCE")
12  public class Residence {
13  	@Id @GeneratedValue
14  	private int id;
15  	@Column(length=16, nullable=false)
16  	private String city;
17  	@Column(length=2, nullable=false)
18  	private String state;
19  	
20  	protected Residence() {}	
21  	public Residence(int id) { this.id = id; }
22  	public Residence(String city, String state) {
23  		this.city = city;
24  		this.state = state;
25  	}
26  
27  	public int getId() { return id; }
28  
29  	public String getCity() { return city; }
30  	public void setCity(String city) {
31  		this.city = city;
32  	}
33  	
34  	public String getState() { return state;}
35  	public void setState(String state) {
36  		this.state = state;
37  	}
38  }