首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate Id生成谋略

2012-09-25 
Hibernate Id生成策略package com.meiyoudao.domainimport javax.persistence.Entityimport javax.persi

Hibernate Id生成策略

package com.meiyoudao.domain;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.TableGenerator;@Entity@TableGenerator(name="sequence_mysql",table="generator_mysql")//可以设置表名,表列名,表初始值等等信息public class PersonAnno {private int id;private String name;private String weight;@Id@GeneratedValue(strategy=GenerationType.TABLE,generator="sequence_mysql")public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getWeight() {return weight;}public void setWeight(String weight) {this.weight = weight;}}

热点排行