hibernate 注解
Posted 方少520
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hibernate 注解相关的知识,希望对你有一定的参考价值。
package com.group.users.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "users")
public class Users implements Serializable {
/**
* b
*/
private static final long serialVersionUID = 1L;
private Integer id;// int(11) NOT NULL用户ID
private String name;// varchar(20) NULL用户登录名
private String password;// varchar(64) NULL登录密码
private Integer shenfen;// int(11) NULL用户权限
private String sex;// varchar(2) NULL性别
private String address;// varchar(50) NULL地址
private String tel;// 电话号码
public Users() {
super();
}
public Users(Integer id, String name, String password, Integer shenfen,
String sex, String address) {
super();
this.id = id;
this.name = name;
this.password = password;
this.shenfen = shenfen;
this.sex = sex;
this.address = address;
}
@Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "password")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "shenfen")
public Integer getShenfen() {
return shenfen;
}
public void setShenfen(Integer shenfen) {
this.shenfen = shenfen;
}
@Column(name = "sex")
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
@Column(name = "address")
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(name = "tel")
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
}
以上是关于hibernate 注解的主要内容,如果未能解决你的问题,请参考以下文章