本文主要是介绍hibernate id 生成策略 annotation @GeneratedValue,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
---------------------
丫的点击率都达到400多了,都没一个给我评论,那么多伸手党。
小心走夜路被人爆菊花。。
------------------------------------
package com.bluedon.ism.commons.entity;
// Generated 2012-7-26 18:24:17 by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.SequenceGenerator;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Table;
/**
* District generated by hbm2java
*/
@Entity
@Table(name = "DISTRICT", schema = "ISM_ACCOUNT")
public class District implements java.io.Serializable {
private String did;
private String districtName;
private String description;
private String parentId;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "DID", unique = true, nullable = false, length = 100)
public String getDid() {
return this.did;
}
public void setDid(String did) {
this.did = did;
}
@Column(name = "DISTRICT_NAME", nullable = false, length = 100)
public String getDistrictName() {
return this.districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
@Column(name = "DESCRIPTION")
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
@Column(name = "PARENT_ID", length = 32)
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
}
---------------------------------------------------
jpa里包
http://repo2.maven.org/maven2/javax/persistence/persistence-api/1.0/
参见 http://blog.sina.com.cn/s/blog_80e498b10100vjcc.html 百度之
这篇关于hibernate id 生成策略 annotation @GeneratedValue的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!