JPA - Shehats/Quip GitHub Wiki
Spring JPA:
JPA:- stands for java persistence Api which Hibernate uses.
so:
public class Account { private Long id; private String username; private String password; private String fname; private String lname; private String email; private byte[] profilePic;
public Account() {
}
public Account(String username, String password, String fname, String lname, String email) {
this.username = username;
this.password = password;
this.fname = fname;
this.lname = lname;
this.email = email;
}
public Account(String username, String password, String fname, String lname, String email, byte[] profilePic) {
this.username = username;
this.password = password;
this.fname = fname;
this.lname = lname;
this.email = email;
this.profilePic = profilePic;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "username")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = "password")
@JsonIgnore
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "fname")
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
@Column(name = "lname")
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
@Column(name = "email")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name = "profilePic")
public byte[] getProfilePic() {
return profilePic;
}
public void setProfilePic(byte[] profilePic) {
this.profilePic = profilePic;
}
}