KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > clusteredentity > Customer


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.ejb3.test.clusteredentity;
23
24 import java.util.Set JavaDoc;
25 import javax.persistence.CascadeType;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
28 import javax.persistence.Id;
29 import javax.persistence.OneToMany;
30 import org.hibernate.annotations.Cache;
31 import org.hibernate.annotations.CacheConcurrencyStrategy;
32
33 /**
34  * Company customer
35  *
36  * @author Emmanuel Bernard
37  * @author Kabir Khan
38  */

39 @Entity
40 @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
41 public class Customer implements java.io.Serializable JavaDoc
42 {
43    Integer JavaDoc id;
44    String JavaDoc name;
45
46    private Set JavaDoc<Contact> contacts;
47
48    public Customer()
49    {
50    }
51
52    @Id
53    public Integer JavaDoc getId()
54    {
55       return id;
56    }
57
58    public void setId(Integer JavaDoc id)
59    {
60       this.id = id;
61    }
62
63    public String JavaDoc getName()
64    {
65       return name;
66    }
67
68    public void setName(String JavaDoc string)
69    {
70       name = string;
71    }
72
73    @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
74    @OneToMany(mappedBy="customer", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
75    public Set JavaDoc<Contact> getContacts()
76    {
77       return contacts;
78    }
79
80    public void setContacts(Set JavaDoc<Contact> contacts)
81    {
82       this.contacts = contacts;
83    }
84 }
85
86
Popular Tags