View Javadoc
1   package myorg.relex.many2one;
2   
3   import javax.persistence.*;
4   /**
5    * This class is an example of a parent in a many-to-one, uni-directional relation where the 
6    * primary key of the child is derived from the primary key of the parent. 
7    */
8   @Entity
9   @Table(name="RELATIONEX_ITEMTYPE")
10  public class ItemType {
11  	@Id @GeneratedValue
12  	private int id;
13  	
14  	@Column(length=20, nullable=false)
15  	private String name;
16  	
17  	protected ItemType() {}
18  	public ItemType(String name) {
19  		this.name = name;
20  	}
21  
22  	public int getId() { return id; }
23  
24  	public String getName() { return name; }
25  	public void setName(String name) {
26  		this.name = name;
27  	}
28  	@Override
29  	public String toString() {
30  		return id +":" + name;
31  	}
32  }