1 22 package org.jboss.ejb3.test.clusteredentity; 23 24 import java.util.Set ; 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 39 @Entity 40 @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL) 41 public class Customer implements java.io.Serializable 42 { 43 Integer id; 44 String name; 45 46 private Set <Contact> contacts; 47 48 public Customer() 49 { 50 } 51 52 @Id 53 public Integer getId() 54 { 55 return id; 56 } 57 58 public void setId(Integer id) 59 { 60 this.id = id; 61 } 62 63 public String getName() 64 { 65 return name; 66 } 67 68 public void setName(String 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 <Contact> getContacts() 76 { 77 return contacts; 78 } 79 80 public void setContacts(Set <Contact> contacts) 81 { 82 this.contacts = contacts; 83 } 84 } 85 86 | Popular Tags |