|
| 1 | +package com.lti.model; |
| 2 | + |
| 3 | +import java.time.LocalDate; |
| 4 | +import java.util.List; |
| 5 | + |
| 6 | +import javax.persistence.CascadeType; |
| 7 | +import javax.persistence.Column; |
| 8 | +import javax.persistence.Entity; |
| 9 | +import javax.persistence.FetchType; |
| 10 | +import javax.persistence.GeneratedValue; |
| 11 | +import javax.persistence.GenerationType; |
| 12 | +import javax.persistence.Id; |
| 13 | +import javax.persistence.OneToMany; |
| 14 | +import javax.persistence.SequenceGenerator; |
| 15 | +import javax.persistence.Table; |
| 16 | + |
| 17 | +@Entity |
| 18 | +@Table(name="tbl_user") |
| 19 | +public class User { |
| 20 | + @Id |
| 21 | + @SequenceGenerator(name="learn_user",initialValue=200,allocationSize=1) |
| 22 | + @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="learn_user") |
| 23 | + int userId; |
| 24 | + String name; |
| 25 | + @Column(unique = true) |
| 26 | + String email; |
| 27 | + LocalDate dateOfBirth; |
| 28 | + String mobileNumber; |
| 29 | + String address; |
| 30 | + String password; |
| 31 | + String aadhaar; |
| 32 | + |
| 33 | + @OneToMany(mappedBy="user",fetch=FetchType.EAGER,cascade=CascadeType.ALL) |
| 34 | + List<Policy> policies; |
| 35 | + |
| 36 | + public int getUserId() { |
| 37 | + return userId; |
| 38 | + } |
| 39 | + |
| 40 | + public void setUserId(int userId) { |
| 41 | + this.userId = userId; |
| 42 | + } |
| 43 | + |
| 44 | + public String getName() { |
| 45 | + return name; |
| 46 | + } |
| 47 | + |
| 48 | + public void setName(String name) { |
| 49 | + this.name = name; |
| 50 | + } |
| 51 | + |
| 52 | + public String getEmail() { |
| 53 | + return email; |
| 54 | + } |
| 55 | + |
| 56 | + public void setEmail(String email) { |
| 57 | + this.email = email; |
| 58 | + } |
| 59 | + |
| 60 | + public LocalDate getDateOfBirth() { |
| 61 | + return dateOfBirth; |
| 62 | + } |
| 63 | + |
| 64 | + public void setDateOfBirth(LocalDate dateOfBirth) { |
| 65 | + this.dateOfBirth = dateOfBirth; |
| 66 | + } |
| 67 | + |
| 68 | + public String getMobileNumber() { |
| 69 | + return mobileNumber; |
| 70 | + } |
| 71 | + |
| 72 | + public void setMobileNumber(String mobileNumber) { |
| 73 | + this.mobileNumber = mobileNumber; |
| 74 | + } |
| 75 | + |
| 76 | + public String getAddress() { |
| 77 | + return address; |
| 78 | + } |
| 79 | + |
| 80 | + public void setAddress(String address) { |
| 81 | + this.address = address; |
| 82 | + } |
| 83 | + |
| 84 | + public String getPassword() { |
| 85 | + return password; |
| 86 | + } |
| 87 | + |
| 88 | + public void setPassword(String password) { |
| 89 | + this.password = password; |
| 90 | + } |
| 91 | + |
| 92 | + public List<Policy> getPolicies() { |
| 93 | + return policies; |
| 94 | + } |
| 95 | + |
| 96 | + public void setPolicies(List<Policy> policies) { |
| 97 | + this.policies = policies; |
| 98 | + } |
| 99 | + |
| 100 | + public String getAadhaar() { |
| 101 | + return aadhaar; |
| 102 | + } |
| 103 | + |
| 104 | + public void setAadhaar(String aadhaar) { |
| 105 | + this.aadhaar = aadhaar; |
| 106 | + } |
| 107 | + |
| 108 | + |
| 109 | +} |
0 commit comments