View Javadoc
1   package myorg.relex.many2one;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This class provides an example of a parent/inverse side of a many-to-one, uni-directional relationship where
7    * the parent and foreign key must use a compound value.
8    */
9   @Entity
10  @Table(name="RELATIONEX_HOUSE")
11  public class House {
12  	@EmbeddedId
13  	@AttributeOverrides({
14  		@AttributeOverride(name="street", column=@Column(name="STREET_NAME", length=20)),
15  	})
16  	private HousePK id;
17  	
18  	@Column(length=16, nullable=false)
19  	private String name;
20  	
21  	protected House() {}
22  	public House(HousePK id, String name) {
23  		this.id = id;
24  		this.name = name;
25  	}
26  	
27  	public HousePK getId() { return id; }
28  
29  	public String getName() { return name; }
30  	public void setName(String name) {
31  		this.name = name;
32  	}
33  }