通过 JDBC 语句执行 DDL "drop sequence player_seq"时出错



在我的实体类中我写了此代码。

 @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "player_Sequence")
        @SequenceGenerator(name = "player_Sequence", sequenceName = "PLAYER_SEQ")

但显示以下错误。

2018-12-19 13:49:54 WARN  o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL "drop sequence team_seq" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "drop sequence team_seq" via JDBC Statement

我有更新application.properties文件,带有下面的代码。

spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.SQLServer2008Dialect

我必须在实体类中使用@GeneratedValue而不是序列。

@Entity
public class Player {
    @GeneratedValue
    @Id
    private Long id;
    @Column(name = "name")
    private String name;
    @Column(name = "num")
    private int num;
    @Column(name = "position")
    private String position;
    @ManyToOne(fetch = FetchType.LAZY)
        @JoinColumn(name = "team_id", nullable = false)
        private Team team;
    public Player() {
    }

最新更新