spring boot + jpa报错:No CurrentSessionContext configured

旧城冷巷雨未停 提交于 2020-01-20 18:52:46

解决办法
1.核心配置文件中要配置方言

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

2.之后添加

spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext

附上本人完整配置文件:

# server
server.port=8081
server.context-path=/

# logs
logging.path=/var/log/demo-activiti-0108-v2-log

# root level
logging.level.root=INFO

# package level
logging.level.com.activiti=DEBUG

# datasource
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/admineap_init
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=none

# activiti default configuration
spring.activiti.check-process-definitions = false

spring.activiti.db-identity-used=false

##thymeleaf
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!