org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Table 'XXX' doesn't exist
2018-01-09 09:31
549 查看
在项目的hibernate.cfg.xml中,我配置好xml后让hibernate自动在mysql建表
可是,运行的时候报错“org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Table ‘XXX’ doesn’t exist”。可见,hibernate并没有帮我们自动创建数据库表文件。于是我手动在数据库中创建表,然后在跑一次程序,果然没有问题了。
原因分析:
数据库方言配置出现问题了,我们需要配置更高版本的数据库方言,具体如下:
hibernate-5.0.7中使用的方言
Hibernate-5.2.10 使用的方言需要升级
解决办法:
在hibernate.cfg.xml中配置 SQL dialect方言。支持mysql高版本的建表。将
这样,hibernate就可以自动来创建数据库表了。
参考文章:https://www.cnblogs.com/zzsaf/p/6902559.html
<property name="hibernate.hbm2ddl.auto">update</property>
可是,运行的时候报错“org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Table ‘XXX’ doesn’t exist”。可见,hibernate并没有帮我们自动创建数据库表文件。于是我手动在数据库中创建表,然后在跑一次程序,果然没有问题了。
原因分析:
数据库方言配置出现问题了,我们需要配置更高版本的数据库方言,具体如下:
hibernate-5.0.7中使用的方言
<!-- 配置数据库方言 --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
Hibernate-5.2.10 使用的方言需要升级
解决办法:
在hibernate.cfg.xml中配置 SQL dialect方言。支持mysql高版本的建表。将
<!-- 配置数据库方言 --> <!--<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>--> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
这样,hibernate就可以自动来创建数据库表了。
参考文章:https://www.cnblogs.com/zzsaf/p/6902559.html
相关文章推荐
- [ERROR][org.hibernate.engine.jdbc.spi.SqlExceptionHelper]Lock wait timeout
- [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]SQL Error: 1064, SQLState: 42000问题的解决办法
- Table 't21.tb_user' doesn't exist...nested exception is org.hibernate.exception.SQLGrammarException:
- ERROR JDBCExceptionReporter:234 - Table 'xxxxxxxx' doesn't exist hibernate无法自动创建表
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- org.hibernate.exception.SQLGrammarExceptionCould not execute JDBC batch update的问题
- org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement错误
- java.lang.ClassNotFoundException: org.hibernate.engine.transaction.spi.TransactionContext
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- hibernate不能自动建表:MySQLSyntaxErrorException: Table '' doesn't exist
- hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- tomcat 启动报错, Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- com.mysql.jdbc.exceptions.MySQLyntaxErrorException:Table'mldn.huiyuan' doesn't exist
- [org.hibernate.util.JDBCExceptionReporter] - ORA-01747: user.table.column, table.column 或列说明无效
- Caused by: java.lang.ClassNotFoundException: org.hibernate.engine.transaction.spi.TransactionContext
- org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update问题的解决
- SQL execution # 1146.Response from database:Table 'xxx' doesn't exist