KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > clusteredentity > bean > Customer


1 //$Id$
2
package org.jboss.tutorial.clusteredentity.bean;
3
4 import java.util.Set JavaDoc;
5
6 import javax.persistence.CascadeType;
7 import javax.persistence.Entity;
8 import javax.persistence.FetchType;
9 import javax.persistence.GeneratorType;
10 import javax.persistence.Id;
11 import javax.persistence.JoinColumn;
12 import javax.persistence.OneToMany;
13 import javax.persistence.OneToOne;
14
15 import org.hibernate.annotations.Cache;
16 import org.hibernate.annotations.CacheConcurrencyStrategy;
17
18 /**
19  * Company customer
20  *
21  * @author Emmanuel Bernard
22  * @author Kabir Khan
23  */

24 @Entity
25 @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
26 public class Customer implements java.io.Serializable JavaDoc
27 {
28    Long JavaDoc id;
29    String JavaDoc name;
30    private Set JavaDoc<Contact> contacts;
31
32    public Customer()
33    {
34    }
35
36    @Id(generate = GeneratorType.IDENTITY)
37    public Long JavaDoc getId()
38    {
39       return id;
40    }
41
42    public void setId(Long JavaDoc long1)
43    {
44       id = long1;
45    }
46
47    public String JavaDoc getName()
48    {
49       return name;
50    }
51
52    public void setName(String JavaDoc string)
53    {
54       name = string;
55    }
56
57    @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
58    @OneToMany(mappedBy="customer", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
59    public Set JavaDoc<Contact> getContacts()
60    {
61       return contacts;
62    }
63
64    public void setContacts(Set JavaDoc<Contact> contacts)
65    {
66       this.contacts = contacts;
67    }
68 }
69
70
Popular Tags