日期:2014-05-16  浏览次数:20704 次

Hibernate的MYSQL序列问题
1.mysql的主键是自动增加的increment。
2.生成entity.java的时候选择org.hibernate.increment.
3.java代码:
// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "userId", unique = true, nullable = false)
	public Integer getUserId() {
		return this.userId;
	}