View Javadoc
1   package myorg.relex.many2one;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This class provides an example one/parent entity in a many-to-one, uni-directional relationship.
7    * For that reason -- this class will not have any reference to the many entities that may possibly 
8    * reference it. These many/child objects must be obtained through the entity manager using a find or query.
9    */
10  @Entity
11  @Table(name="RELATIONEX_STATE")
12  public class State {
13  	@Id @Column(length=2)
14  	private String id;
15  	
16  	@Column(length=20, nullable=false)
17  	private String name;
18  	
19  	protected State() {}
20  	public State(String id, String name) {
21  		this.id = id;
22  		this.name = name;
23  	}
24  	
25  	public String getId() { return id; }
26  
27  	public String getName() { return name; }
28  	public void setName(String name) {
29  		this.name = name;
30  	}
31  }