我正在使用spring boot
,spring Datasource
和postgresql
,我的问题是无法将对象保存到数据库中。表名和列名都是驼峰式的。
属性文件:
spring.datasource.driverClassName=org.postgresql.Driver spring.datasource.url=jdbc:postgresql://localhost:5432/encoderDb
spring.datasource.initialize=true spring.datasource.username=user spring.datasource.password=password
spring.jpa.generate-ddl=false
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
实体类
@Entity
@Table(name="\"TableEncoder\"")
public class TableEncoder implements Serializable {
@Id
@Column(name="\"encoderId\"")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer encoderId;
@Column(name="\"aspectRatio\"")
private String aspectRatio;
@Column(name="\"audioBitRate\"")
private Integer audioBitRate;
}
错误:
2018-01-31 18:40:12.179 WARN 32163 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42703 2018-01-31 18:40:12.179 ERROR 32163 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : The column name "encoderId" was not found in this ResultSet.
请注意,除了保存,我可以从同一个表中删除并列出数据。