【发布时间】:2019-09-06 14:06:42
【问题描述】:
我的 spring-boot + hibernate 和我的数据库有问题。 当我使用 CrudRepository.save(...) 保存实体时,有时我的实体仅从 JPA 保存,但它不在数据库中。
以为没有设置刷新模式,我将以下配置放在 application.yaml 中,但它没有改变任何东西。可能没有设置模式?
spring:
liquibase:
enabled: true
change-log: classpath:db/changelog/db.changelog-master.xml
datasource:
url: jdbc:postgresql://localhost:26257/mydb?sslmode=disable
username: myuser
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQL94Dialect
flushMode: ALWAYS
org:
hibernate:
flushMode: ALWAYS
show-sql: true
database-platform: org.hibernate.dialect.PostgreSQL94Dialect
hibernate:
ddl-auto: create
logging:
level:
org.hibernate.SQL: DEBUG
org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl: ERROR
org.hibernate.type.descriptor.sql.BasicBinder: TRACE
server:
port: 8081
@Repository
public interface PermissionRepository extends CrudRepository<Permission, Integer> {
}
有什么想法吗? 谢谢:)
【问题讨论】:
标签: database hibernate spring-boot jpa