View Javadoc
1   package ejava.projects.esales.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.Id;
9   import javax.persistence.Table;
10  
11  /**
12   * This class provides a thin example of how to setup an Address business
13   * object class for the project. Only a few fields are mapped and we
14   * will make full use of JPA annotations over an orm.xml file in this 
15   * example.
16   * 
17   * @author jcstaff
18   *
19   */
20  @SuppressWarnings("serial")
21  @Entity @Table(name="ESALES_ADDRESS")
22  public class Address implements Serializable {
23  	private long id;
24  	private String name;
25  	private String city;
26  	
27  	public Address() {} 	
28  	public Address(long id) {
29  		setId(id); //use the set method to remove the unused warning
30  	}
31  	
32  	public Address(long id, String name, String city) {
33  		this.id = id;
34  		this.name = name;
35  		this.city = city;
36  	}
37  	
38  	@Id @GeneratedValue @Column(name="ID")
39  	public long getId() {
40  		return id;
41  	}
42  	private void setId(long id) {
43  		this.id = id;
44  	}
45  	
46  	@Column(name="NAME")
47  	public String getName() {
48  		return name;
49  	}
50  	public void setName(String name) {
51  		this.name = name;
52  	}
53  	
54  	@Column(name="CITY")
55  	public String getCity() {
56  		return city;
57  	}
58  	public void setCity(String city) {
59  		this.city = city;
60  	}
61  	
62  	public String toString() {
63  		StringBuilder text = new StringBuilder();
64  		text.append("id=" + id);
65  		text.append(", name=" + name);
66  		text.append(", city=" + city);
67  		return text.toString();
68  	}
69  }