注解JAVA对象(基于Hibernate4.3)

package com.chauvet.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType; import org.hibernate.annotations.GenericGenerator; @Entity
@Table(name="user")
public class User{
private String id;
private String name;
private int sex;
private int age;
private Date createTime;
private Date registerTime; @Id
@GenericGenerator(name="systemUUID",strategy="uuid")
@GeneratedValue(generator="systemUUID")
@Column(name = "id", insertable = true, updatable = true, nullable = false,length = 32)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
} @Column(name="name",length=32)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} @Column(name="sex")
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
} @Column(name="age")
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
} @Temporal(TemporalType.TIMESTAMP)
@Column(name="createTime")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
} @Temporal(TemporalType.TIMESTAMP)
@Column(name="registerTime")
public Date getRegisterTime() {
return registerTime;
}
public void setRegisterTime(Date registerTime) {
this.registerTime = registerTime;
}
}
上一篇:MySQL驱动和数据库字符集设置不搭配


下一篇:2017年11月30日 C#TreeNode递归&邮箱验证&新用户窗体