oracle配置:
package com.test.hibernate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
@Entity
@SequenceGenerator(name="categorySEQ",sequenceName="seq_for_category")
public class Category {
private int id;
private String name;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="categorySEQ")
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;
}
}