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

你可能感兴趣的:(Hibernate)