1 25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest01; 26 27 import java.util.Map ; 28 29 import javax.persistence.Entity; 30 import javax.persistence.GeneratedValue; 31 import javax.persistence.GenerationType; 32 import javax.persistence.Id; 33 import javax.persistence.MapKey; 34 import javax.persistence.OneToMany; 35 36 42 @Entity 43 public class Building { 44 45 48 private Long id; 49 50 53 private String name; 54 55 58 private Map < RoomPK, Room> rooms; 59 60 64 @Id 65 @GeneratedValue(strategy = GenerationType.AUTO) 66 public Long getId() { 67 return id; 68 } 69 70 71 75 public void setId(final Long id) { 76 this.id = id; 77 } 78 79 80 84 public String getName() { 85 return name; 86 } 87 88 92 public void setName(final String name) { 93 this.name = name; 94 } 95 96 100 @OneToMany(mappedBy="building") 101 @MapKey 102 public Map <RoomPK, Room> getRooms() { 103 return rooms; 104 } 105 106 107 111 public void setRooms(final Map <RoomPK, Room> rooms) { 112 this.rooms = rooms; 113 } 114 115 116 } 117 | Popular Tags |