Newer
Older
JerseyDemo / src / main / java / com / example / springtest / demo / entities / User.java
package com.example.springtest.demo.entities;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.*;
import java.net.URI;

@Entity // This tells Hibernate to make a table out of this class
@Table(name="USERS")
public class User {
    @Id
//    @GeneratedValue(strategy= GenerationType.AUTO)
    public String uId;
    public String name;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    public String password;
    public URI uri;

    public User() {
    }

    public User(String uId, String name, String password) {
        this.uId = uId;
        this.name = name;
        this.password = password;
        this.uri = URI.create("./users/" + uId);
    }

//    public User(String uId, String name, String password, String uri) {
//        this.uId = uId;
//        this.name = name;
//        this.password = password;
//        this.uri = uri;
//    }

    public String getuId() {
        return uId;
    }

    public String getName() {
        return name;
    }

    public String getPassword() {
        return password;
    }

    public void setuId(String uId) {
        this.uId = uId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUri(URI uri) {
        this.uri = uri;
    }
}