英文:
PSQLException: The column name start_value was not found in this ResultSet
问题
以下是您提供的内容的翻译:
我在启动Spring Boot Maven应用程序时遇到了PostgreSQL异常。
Maven依赖项:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
属性文件:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/db
spring.datasource.username=postgres
spring.datasource.password=postgres
异常信息:
org.postgresql.util.PSQLException: 在此ResultSet中找不到列名start_value。
at org.postgresql.jdbc.PgResultSet.findColumn(PgResultSet.java:2748) ~[postgresql-42.2.16.jar:42.2.16]
at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2631) ~[postgresql-42.2.16.jar:42.2.16]
at com.zaxxer.hikari.pool.HikariProxyResultSet.getLong(HikariProxyResultSet.java) ~[HikariCP-3.4.5.jar:na]
at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.resultSetStartValueSize(SequenceInformationExtractorLegacyImpl.java:129) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:59) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.sequenceInformationList(JdbcEnvironmentImpl.java:403) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.<init>(JdbcEnvironmentImpl.java:268) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
请注意,我已经按照您的要求将代码部分翻译成中文,如有其他需要,请随时告知。
英文:
I am getting Postgresql Exception, when spring-boot maven application is starting up.
Maven Dependency
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
Property file
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/db
spring.datasource.username=postgres
spring.datasource.password=postgres
Exception
org.postgresql.util.PSQLException: The column name start_value was not found in this ResultSet.
at org.postgresql.jdbc.PgResultSet.findColumn(PgResultSet.java:2748) ~[postgresql-42.2.16.jar:42.2.16]
at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2631) ~[postgresql-42.2.16.jar:42.2.16]
at com.zaxxer.hikari.pool.HikariProxyResultSet.getLong(HikariProxyResultSet.java) ~[HikariCP-3.4.5.jar:na]
at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.resultSetStartValueSize(SequenceInformationExtractorLegacyImpl.java:129) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:59) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.sequenceInformationList(JdbcEnvironmentImpl.java:403) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.<init>(JdbcEnvironmentImpl.java:268) ~[hibernate-core-5.4.21.Final.jar:5.4.21.Final]
at
答案1
得分: 1
使用以下自定义类,并将其传递给属性。
package com.abc.def;
import org.hibernate.dialect.PostgreSQL95Dialect;
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
public class PostgresqlCustomDialect extends PostgreSQL95Dialect {
public String getQuerySequencesString() {
return "select * from all_sequences";
}
public SequenceInformationExtractor getSequenceInformationExtractor() {
return SequenceInformationExtractorNoOpImpl.INSTANCE;
}
}
将完全限定的类名放入以下属性中:
p.put("hibernate.dialect", "com.abc.def.PostgresqlCustomDialect");
英文:
Use the below custom class and pass it in the property.
package com.abc.def;
import org.hibernate.dialect.PostgreSQL95Dialect;
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
public class PostgresqlCustomDialect extends PostgreSQL95Dialect {
public String getQuerySequencesString() {
return "select * from all_sequences";
}
public SequenceInformationExtractor getSequenceInformationExtractor() {
return SequenceInformationExtractorNoOpImpl.INSTANCE;
}
}
Put fully qualified class name in below property :
p.put("hibernate.dialect","com.abc.def.PostgresqlCustomDialect");
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论