简体   繁体   中英

Hibernate Sequence generation in ms sql server

We are using @sequencegenerator annotations to generate sequence in mssql database but when we execute sequence is generated as table instead of sequence, we have used 2012Dialect but still we face same issue and application throws exception invalid object name - sequence name-. Please help with solution

Have you used GeneratedValue annotation to specify that the id generation value witll be from a database sequence?

example:

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_name")
@SequenceGenerator(name = "seq_name", sequenceName = "seq_name_in_database", allocationSize = 1)
@Column(name = "id")
private Long id;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM