Advertisement
Guest User

Untitled

a guest
Sep 30th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. package com.techpro.webstat.models;
  2.  
  3. import javax.persistence.*;
  4.  
  5. @Entity
  6. @Table(name = "users")
  7. public class User {
  8.  
  9.     public Role ro;
  10.     public int user_id;
  11.     public String username;
  12.     public String password;
  13.     public int enabled = 1;
  14.  
  15.     public User() {
  16.     }
  17.  
  18.  
  19.  
  20.     public User(String username, String password, int enabled) {
  21.         this.username = username;
  22.         this.password = password;
  23.         this.enabled = enabled;
  24.  
  25.     }
  26.  
  27.     @Id
  28.     @GeneratedValue(strategy = GenerationType.AUTO)
  29.     public int getUser_id() {
  30.         return user_id;
  31.     }
  32.  
  33.     public void setUser_id(int user_id) {
  34.         this.user_id = user_id;
  35.     }
  36.  
  37.     @OneToOne(cascade = CascadeType.ALL)
  38.     @JoinColumn(name = "username", referencedColumnName = "username", insertable = false, updatable = false)
  39.     public Role getRo() {
  40.         return ro;
  41.     }
  42.  
  43.     public void setRo(Role ro) {
  44.         this.ro = ro;
  45.     }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.     @Column(name = "username")
  56.     public String getUsername() {
  57.         return username;
  58.     }
  59.  
  60.     public void setUsername(String username) {
  61.         this.username = username;
  62.     }
  63.  
  64.     @Column(name = "password")
  65.     public String getPassword() {
  66.         return password;
  67.     }
  68.  
  69.     public void setPassword(String password) {
  70.         this.password = password;
  71.     }
  72.  
  73.     @Column(name = "enabled")
  74.     public int getEnabled() {
  75.         return enabled;
  76.     }
  77.  
  78.     public void setEnabled(int enabled) {
  79.         this.enabled = enabled;
  80.     }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement