Advertisement
Guest User

ejb

a guest
Dec 12th, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. @Entity
  2. public class Person implements Serializable {
  3.  
  4.     private static final long serialVersionUID = 1L;
  5.     @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
  6.     private int id;
  7.     private String name;
  8.     @OneToOne
  9.     private Person test;
  10.  
  11.  
  12. @Entity
  13. public class PersonGroup implements Serializable {
  14.  
  15.     private static final long serialVersionUID = 1L;
  16.  
  17.     public enum PersonType{MALE,FEMALE}
  18.    
  19.     @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
  20.     private int id;
  21.     private PersonType personType;
  22.     @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
  23.     private Collection<Person> persons = new Vector<Person>();
  24.  
  25.  
  26. @Entity
  27. @Table(name="pairs")
  28. public class Pair implements Serializable {
  29.  
  30.     private static final long serialVersionUID = 1L;
  31.  
  32.     @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
  33.     private int id;
  34.     @OneToOne
  35.     private Person personA;
  36.     @OneToOne
  37.     private Person personB;
  38.  
  39.  
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement