Blame view

src/main/java/fr/plil/sio/persistence/api/User.java 902 Bytes
fd5e74ca   jcartign   First student ver...
1
2
  package fr.plil.sio.persistence.api;
  
e5e76a48   jcartign   Add persistence a...
3
4
  import javax.persistence.*;
  
d41edfbc   jcartign   Migrate modificat...
5
6
7
8
9
  /**
   * An user MUST have a group in the database.
   * An user is unique by it name, i.e. database cannot contain two user with the same name or the same ID.
   */
  
e5e76a48   jcartign   Add persistence a...
10
11
  @Entity
  @Table(name = "USER_T")
fd5e74ca   jcartign   First student ver...
12
13
  public class User {
  
e5e76a48   jcartign   Add persistence a...
14
15
16
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "USER_ID")
fd5e74ca   jcartign   First student ver...
17
18
      private Long id;
  
e5e76a48   jcartign   Add persistence a...
19
      @Column(name = "NAME_C")
fd5e74ca   jcartign   First student ver...
20
21
      private String name;
  
e5e76a48   jcartign   Add persistence a...
22
23
      @ManyToOne
      @JoinColumn(name = "GROUP_C")
fd5e74ca   jcartign   First student ver...
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
      private Group group;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public Group getGroup() {
          return group;
      }
  
      public void setGroup(Group group) {
          this.group = group;
      }
  }