如何在春天使用@SequenceGenerator

时间:2011-05-05 13:09:57

标签: spring jpa

如何在Spring中使用@SequenceGenerator

1 个答案:

答案 0 :(得分:1)

你没有。

这就是说,javax.persistence.SequenceGenerator与春天无关;这是JPA(Hibernate,Toplink,...); e.g:

@Entity
@Table(name = "APPLICATION")
public class Application {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "APPLICATION_SEQ")
@SequenceGenerator(name = "APPLICATION_SEQ", sequenceName = "APPLICATION_SEQ", allocationSize = 1)
@Column(name = "APPLICATION_ID")
private Integer id;