2. Model classes
JPA related Stuff
1. Model class annotations
@Entity
@Table(name = "user")
public class User {
@Id
@Column(name = "id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "user_name")
private String userName;
@Column(name = "password")
private String password;
public User() {
super();
}
public User(int id, String userName, String password) {
super();
this.id = id;
this.userName = userName;
this.password = password;
}
}
1. Model class annotations
@Entity
@Table(name = "user")
public class User {
@Id
@Column(name = "id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "user_name")
private String userName;
@Column(name = "password")
private String password;
public User() {
super();
}
public User(int id, String userName, String password) {
super();
this.id = id;
this.userName = userName;
this.password = password;
}
}
Comments
Post a Comment