嗨,我正在使用(JPA)为一个对象用户开发持久层,我正在编辑器中编写代码,而不是使用 spring hibernate 我编写了以下代码,但它显示包 javax.persistence。*;没有找到我如何使它工作可以帮助任何人。
这是我写的课。
//import javax.persistence.*;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@Entity(name = "USER") //Name of the entity
public class User implements Serializable
{
private int userId;
private String userName;
private String password;
private String firstName;
private String lastName;
private String roles;
@Id
@Column(name = "USER_ID", nullable = false)
public int getUserId()
{
return userId;
}
public void setUserId(int UserId)
{
this.userId = userId;
}
@Column(name = "USER_NAME", nullable = false)
public String getUserName()
{
return userName;
}
public void setUserName(int userName)
{
this.userName = userName;
}
@Column(name = "PASSWORD", nullable = false)
public String getPassword()
{
return password;
}
public void setPassword(int password)
{
this.password = password;
}
@Column(name = "FIRST_NAME", nullable = false)
public String getFirstName()
{
return firstName;
}
public void setFirstName(int firstName)
{
this.firstName = firstName;
}
@Column(name = "LAST_NAME", nullable = false)
public String getLastName()
{
return lastName;
}
public void setLastName(int lastName)
{
this.lastName = lastName;
}
@Column(name = "ROLES", nullable = false)
public String getRoles()
{
return roles;
}
public void setRoles(int roles)
{
this.roles = roles;
}
public User()
{
}
}