注解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; } }
作者:wxw_wang
-------------------------------------------
个性签名:做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
万水千山总是情,打赏一分行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!