1 package myorg.relex.one2many;
2
3 import java.util.HashSet;
4 import java.util.Set;
5 import javax.persistence.*;
6
7
8
9
10
11
12 @Entity
13 @Table(name="RELATIONEX_SUSPECT")
14 public class Suspect {
15 @Id @GeneratedValue
16 private int id;
17 @Column(length=32)
18 private String name;
19
20 @ElementCollection
21 @CollectionTable(
22 name="RELATIONEX_SUSPECT_ALIASES",
23 joinColumns=@JoinColumn(name="SUSPECT_ID"),
24 uniqueConstraints=@UniqueConstraint(columnNames={"SUSPECT_ID", "ALIAS"}))
25 @Column(name="ALIAS", length=32)
26 private Set<String> aliases;
27
28 public int getId() { return id; }
29
30 public String getName() { return name; }
31 public void setName(String name) {
32 this.name = name;
33 }
34
35 public Set<String> getAliases() {
36 if (aliases==null) { aliases = new HashSet<String>(); }
37 return aliases;
38 }
39 public void setAliases(Set<String> aliases) {
40 this.aliases = aliases;
41 }
42 }