Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ``` java
- package com.example.models;
- import java.io.Serializable;
- import java.time.LocalDate;
- import java.util.Objects;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- import springfox.documentation.annotations.ApiIgnore;
- @ApiIgnore
- @Entity
- public class User implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 6846117438634217888L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private Long id;
- @Column(name = "first_name")
- private String firstName;
- @Column(name = "last_name")
- private String lastName;
- @Column(name = "username")
- private String username;
- @Column(name = "password")
- private String password;
- @Column(name = "age")
- private Integer age;
- @Column(name = "birthDay")
- private LocalDate birthDay;
- public User() {
- }
- public User(Long id, String firstName, String lastName, String username, String password, Integer age, LocalDate birthDay) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.username = username;
- this.password = password;
- this.age = age;
- this.birthDay = birthDay;
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getFirstName() {
- return firstName;
- }
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
- public String getLastName() {
- return lastName;
- }
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public Integer getAge() {
- return age;
- }
- public void setAge(Integer age) {
- this.age = age;
- }
- public LocalDate getBirthDay() {
- return birthDay;
- }
- public void setBirthDay(LocalDate birthDay) {
- this.birthDay = birthDay;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof User)) return false;
- User user = (User) o;
- return Objects.equals(getId(), user.getId()) &&
- Objects.equals(getUsername(), user.getUsername());
- }
- @Override
- public int hashCode() {
- return Objects.hash(getId(), getUsername());
- }
- @Override
- public String toString() {
- return "User{" +
- "id=" + id +
- ", firstName='" + firstName + '\'' +
- ", lastName='" + lastName + '\'' +
- ", username='" + username + '\'' +
- ", password='" + password + '\'' +
- ", age=" + age +
- ", birthDay=" + birthDay +
- '}';
- }
- }
- '''
Add Comment
Please, Sign In to add comment