org.springframework.boot 2.1.8.RELEASE Redshift

我遇到的第一个错误


无效操作:不支持 SQL 命令“如果存在 hibernate_sequence,则删除序列”


在例外情况的更下方,我看到以下内容。我假设我必须更改 hibernate_sequence 中索引递增的方式。


Caused by: com.amazon.support.exceptions.ErrorException: [Amazon](500310) Invalid operation: SQL command "create sequence hibernate_sequence start 1 increment 1" not supported.;

    ... 49 common frames omitted

2019-10-07 14:02:30,237 WARN  [main] org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Error executing DDL "create sequence hibernate_sequence start 1 increment 1" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create sequence hibernate_sequence start 1 increment 1" via JDBC Statement

在构建 java Spring Boot 应用程序时,寻求连接并创建新的 redshift DB Cluster V1.0.10393。


POM 和属性文件应该是什么样子?我正在从工作 PostgreSQL 数据库过渡到 redshift。


当前属性


spring.datasource.driver-class-name=com.amazon.redshift.jdbc42.Driver

spring.datasource.url=jdbc:redshift://redshift-cluster-1.cwirererbv4xb.us-east-2.redshift.amazonaws.com:5439/db

spring.datasource.username=awsuser

spring.datasource.password=werwerwerew

spring.jpa.hibernate.ddl-auto=create

spring.jpa.show-sql=true

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL9Dialect

spring.datasource.hikari.connectionTimeout=20000

spring.datasource.hikari.maximumPoolSize=5

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

spring.jpa.open-in-view=false

spring.jpa.hibernate.ddl-auto=create


HUX布斯
浏览 63回答 2
2回答

侃侃尔雅

我遇到的错误是因为我使用了生成的 ID@Id@GeneratedValue(strategy = GenerationType.AUTO)@javax.persistence.Idprivate long id;我已将其替换为@EmbeddedId。命名索引也被删除。

哔哔one

就我而言,因为我输入了错误的驱动程序类名称,所以我输入了 PostGresSQL 而不是 mySQL。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java