为什么序列标识在SQL服务器序列中不起作用?
@GenericGenerator( name = "sequence",
strategy = "sequence-identity",
parameters = {
@org.hibernate.annotations.Parameter(
name = "sequence",
value = "SEQ_PARTNER_TIMETABLE_ID"
)
})
答案 0 :(得分:0)
试试这个:
在SQL Server中创建一个序列
CREATE SEQUENCE [schema_name . ]sequence_name
START WITH 1
INCREMENT BY 1
NO CYCLE
;
然后在您实体的ID
中调用此序列@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "users_seq_gen")
@SequenceGenerator(name = "users_seq_gen", sequenceName = "sequence_name")