1 package org.jboss.tutorial.clusteredentity.bean; 3 4 import java.util.Set ; 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 24 @Entity 25 @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL) 26 public class Customer implements java.io.Serializable 27 { 28 Long id; 29 String name; 30 private Set <Contact> contacts; 31 32 public Customer() 33 { 34 } 35 36 @Id(generate = GeneratorType.IDENTITY) 37 public Long getId() 38 { 39 return id; 40 } 41 42 public void setId(Long long1) 43 { 44 id = long1; 45 } 46 47 public String getName() 48 { 49 return name; 50 } 51 52 public void setName(String 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 <Contact> getContacts() 60 { 61 return contacts; 62 } 63 64 public void setContacts(Set <Contact> contacts) 65 { 66 this.contacts = contacts; 67 } 68 } 69 70 | Popular Tags |