上面那一大坨有實用價值嗎
這個是netbeans自動生成的實體類,不是Hibernate的
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "DB_USER")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "DbUser.findAll", query = "SELECT d FROM DbUser d"),
@NamedQuery(name = "DbUser.findById", query = "SELECT d FROM DbUser d WHERE d.id = :id"),
@NamedQuery(name = "DbUser.findByName", query = "SELECT d FROM DbUser d WHERE d.name = :name"),
@NamedQuery(name = "DbUser.findByPassword", query = "SELECT d FROM DbUser d WHERE d.password = :password"),
@NamedQuery(name = "DbUser.findByLev", query = "SELECT d FROM DbUser d WHERE d.lev = :lev")})
public class DbUser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Column(name = "NAME")
private String name;
@Column(name = "PASSWORD")
private String password;
@Column(name = "LEV")
private Integer lev;
public DbUser() {
}
public DbUser(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getLev() {
return lev;
}
public void setLev(Integer lev) {
this.lev = lev;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DbUser)) {
return false;
}
DbUser other = (DbUser) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.bean.DbUser[ id=" + id + " ]";
}
}
問答模塊應該整個自己可以刪除問題的按鈕