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_查询出来的数据时正确的,就是多了一个前缀,这怎么解决啊,麻烦高手解答一下,谢谢!
[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_查询出来的数据时正确的,就是多了一个前缀,这怎么解决啊,麻烦高手解答一下,谢谢!
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.oristand.nitpro.entity.Users" table="users" catalog="jbpm">
<id name="userId" type="java.lang.Integer">
<column name="userId" />
<generator class="native" />
</id>
<property name="name" type="java.lang.String">
<column name="name" length="50" not-null="true" />
</property>
<property name="zhiw" type="java.lang.String">
<column name="zhiw" length="50" not-null="true" />
</property>
</class>
</hibernate-mapping>
Action方法:
这样就OK了,
为什么LZ不反向生成pojo和xml文件呢?