org.hibernate.exception.SQLGrammarException: could not execute query

来源:互联网 发布:平湖哪里有淘宝培训 编辑:程序博客网 时间:2024/05/29 03:27

一般这个问题是由于用了工具自动生成*.hbm.xml文件 而发生的错误,一开始你的程序是好的,但是在你换了台机器,访问的数据库有变化时(也许用到里面的表都没有变动),可能就会出现org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update的问题解决办法是把*.hbm.xml文件的  schema=" " 改为现在对应的用户<hibernate-mapping>
    <class name="com.ecai.bean" table="Member" schema="web" catalog="ecai">
        <id name="rid" column="RID"  type="long">
            <generator class="increment" />这样就能够连接上你的数据库,但是这样对有的程序来说是可以的,有的就会报 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &apos;.member member0_ where member0_.UserName=&apos;ad&apos; and member0_.UserPass=&apos;7815696ecbf&apos; 类似于这样的错误,这个是由于你的数据库表的结构和你换到另一台机子上的数据库表结构不一样,一定要对应好,就连数据库表名的大小写都要对应好。

奇怪了今天给网友调试ssh的时候也是报的这个错误,但是必须要把schema="web" catalog="ecai"类似于这个东东去掉才可以,晕了,但是什么时候用哪一个也不清楚了