HibernateException:缺少列:名称错误

问题描述 投票:4回答:2

在我的Java代码中,我有一个名为isNegative的字段,数据库中存在类似的列。但是Hibernate坚持认为这个名字应该是is_negative,即使强迫@Column这个名字。

@Column(name="isNegative")
private boolean isNegative;

错误:

引起:org.hibernate.HibernateException:缺少列:datasource.item中的is_negative

application.properties:

#JPA
spring.data.jpa.repositories.enabled=false
spring.jpa.database=mysql
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.open-in-view=true
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.hibernate.use-new-id-generator-mappings=false
spring.jpa.properties.hibernate.event.merge.entity_copy_observer=allow
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
java spring hibernate hibernate-mapping naming
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.