View Javadoc
1   package ejava.projects.eleague.bo;
2   
3   import java.io.Serializable;
4   
5   import javax.persistence.Column;
6   import javax.persistence.Entity;
7   import javax.persistence.GeneratedValue;
8   import javax.persistence.GenerationType;
9   import javax.persistence.Id;
10  import javax.persistence.Table;
11  
12  /**
13   * This class provides a thin example of how to setup an Address business
14   * object class for the project. Only a few fields are mapped and we
15   * will make full use of JPA annotations over an orm.xml file in this 
16   * example.
17   */
18  @Entity @Table(name="ELEAGUE_ADDR")
19  public class Address implements Serializable {
20  	private static final long serialVersionUID = 1L;
21  
22  	@Id @GeneratedValue(strategy=GenerationType.IDENTITY) 
23  	@Column(name="ID")
24  	private long id;
25  
26  	@Column(name="CITY", length=20)
27  	private String city;
28  	
29  	public Address() {} 	
30  	public Address(long id) {
31  		setId(id); //use the set method to remove the unused warning
32  	}
33  	
34  	public Address(long id, String city) {
35  		this.id = id;
36  		this.city = city;
37  	}
38  	
39  	public long getId() {
40  		return id;
41  	}
42  	private void setId(long id) {
43  		this.id = id;
44  	}
45  	
46  	public String getCity() {
47  		return city;
48  	}
49  	public void setCity(String city) {
50  		this.city = city;
51  	}
52  	
53  	public String toString() {
54  		StringBuilder text = new StringBuilder();
55  		text.append("id=").append(id);
56  		text.append(", city=").append(city);
57  		return text.toString();
58  	}
59  }