admin管理员组文章数量:1410737
I have a PostgreSQL database with Spring Boot configured to use:
spring.jpa.hibernate.ddl-auto: update
When I start Spring Boot app. Tables are created but sequences configured into entities are not.
I tried with spring.jpa.generate-ddl: true
with results in created sequences.
Do you know why this setting is not working for database sequinces?
I have a PostgreSQL database with Spring Boot configured to use:
spring.jpa.hibernate.ddl-auto: update
When I start Spring Boot app. Tables are created but sequences configured into entities are not.
I tried with spring.jpa.generate-ddl: true
with results in created sequences.
Do you know why this setting is not working for database sequinces?
Share Improve this question asked Mar 25 at 2:11 Peter PenzovPeter Penzov 1,608156 gold badges499 silver badges907 bronze badges1 Answer
Reset to default 0You need to explicitly define the sequences in your entity class:
@Entity
public class Entity {
@Id
@SequenceGenerator(name="seq",sequenceName="your_seq")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq")
private Integer id;
}
本文标签: springjpahibernateddlauto update is not creating database sequencesStack Overflow
版权声明:本文标题:spring.jpa.hibernate.ddl-auto: update is not creating database sequences - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744220148a2595825.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论