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;}}