org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not load an entity: [com.oristand.nitpro.entity.Users#9]; bad SQL grammar
[select users0_.userId as userId0_, users0_.name as name0_0_, users0_.zhiw as zhiw0_0_ from jbpm__users users0_ where users0_.userId=?];
nested exception is com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'jbpm.jbpm__users' doesn't exist
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'jbpm.jbpm__users' doesn't exist
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
我的表名叫users,生成的语句中的表名却是jbpm_users,我的数据库名叫jbpm,我讲生成的sql语句复制到数据库中去掉jbpm_查询出来的数据时正确的,就是多了一个前缀,这怎么解决啊,麻烦高手解答一下,谢谢!
------解决方案--------------------
映射文件,和执行的HQL拿来
------解决方案--------------------
你的映射文件里指定了,不信你去看。
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
catalog="jbpm"去掉
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
catalog="jbpm" 这在hibernate里是类似数据库schema的概念
你如果每次都是指明了数据库的HQL操作,这个配置就没什么作用了,去掉即可