`

could not execute query

阅读更多

一般这个问题是由于用了工具自动生成*.hbm.xml文件 而发生的错误,一开始你的程序是好的,但是在你换了台机器,访问的数据库有变化时(也许用到里面的表都没有变动),可能就会出现org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update的问题解决办法是把*.hbm.xml文件的  schema=" " 改为现在对应的用户

User.hbm.xml

<?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.wbj.pojo.User" table="user" catalog="bbs" schema="sinoest">
        <id name="id" type="java.lang.Integer">
            <column name="Id" />
            <generator class="increment" />
        </id>
        <property name="username" type="java.lang.String">
            <column name="username" length="20" />
        </property>
        <property name="password" type="java.lang.String">
            <column name="password" length="20" />
        </property>
        <property name="quanxian" type="java.lang.String">
            <column name="quanxian" length="2" />
        </property>
    </class>
</hibernate-mapping>

分享到:
评论
1 楼 love8441258 2009-07-26  
请问楼主 schema=" "  这个我在*.hbm.xml文件的里没有看到呢?可以把你的*.hbm.xml文件贴出来一个吗?

相关推荐

    SSH整合项目中容易出现的错误

    3. org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query;nested exception is org.hibernate.exception.SQLGrammarException: could not execute query 这个错误是由于SQL...

    ssh框架报错分析集合

    nested exception is org.hibernate.exception.SQLGrammarException: could not execute query` 这个异常表明执行SQL查询时出现了语法错误。检查并修正相关的SQL语句,确保其符合SQL语法规范,并且与数据库表结构...

    C# 链接mysql数据库 出现 给定关键字不在字典中

    在C#编程中,连接MySQL数据库是常见的任务,但有时候可能会遇到一些问题,例如“给定关键字不在字典中”的错误。这个问题通常与使用的MySQL数据访问驱动(MySql.Data.dll)有关。以下是对这个错误的详细分析和解决...

    SSH项目原本使用的sqlserver2005数据库现在改用MySql配置问题修改

    在将SSH项目从SQL Server 2005迁移至MySQL时,出现的“org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query”异常通常意味着数据访问层在尝试执行SQL查询时遇到了问题。...

    框架集合错误解决方案

    nested exception is org.hibernate.exception.SQLGrammarException: could not execute query ``` **问题描述:** 这通常是因为Hibernate执行SQL查询时遇到了语法错误或者数据表结构不匹配等问题。 **解决方法:...

    关键字user附近有语法错误解决方案

    警告: SQL Error: 156, ...org.hibernate.exception.SQLGrammarException: could not execute query org.hibernate.util.JDBCExceptionReporter logExceptions 严重: 关键字 'user' 附近有语法错误。 的解决方案。

    MySQL数据库服务器下C3P0连接池的配置.pdf

    项目的应用程序部署好后,每过一段时间(比如一个晚上),应用程序没有被调用,然后一旦程序访问MySQL数据库就会抛出异常:java代码org.hibernation.exception.JDBCConnectionException:could not execute query。...

    openousd-api:OpenOUSD的后端材料

    运行本地数据库 设置 注意:需要安装并运行 。...postgres_1 | pg_restore: [archiver (db)] could not execute query: ERROR: table "bargaining_units" does not exist postgres_1 | Command was: DROP TABLE publi

    php连接数据库代码应用分析

    die("Could not execute query: " . mysql_error()); } while ($result_row = mysql_fetch_row($result)) { $num = $result_row[0]; $age = $result_row[1]; $name = $result_row[2]; echo "&lt;tr&gt;&lt;td&gt;" . $num ....

    SSH整合常见错误总结

    **问题描述**:执行Hibernate操作时,如插入数据,遇到`org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update`异常。 **原因分析**:这通常是由于数据库表不存在或表结构不匹配引起...

    thinkphp5 连接SqlService需要的扩展

    $result = Db::connect('sqlsrv')-&gt;query('SELECT * FROM your_table'); ``` 5. **错误处理**:在连接或操作数据库时,务必进行错误处理。ThinkPHP5提供了异常处理机制,当发生错误时,可以捕获并处理异常: ```...

    微软内部资料-SQL性能优化5

    If even one column in the query is not part of the index, the data rows must be accessed. The leaf level of an index is the only level that contains every key value, or set of key values. For a ...

    MyEclipse报错说明

    3. **Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update** Hibernate在执行数据库批处理更新时出现SQL语法错误,可能是由于数据库表不存在或结构不符...

    微软内部资料-SQL性能优化3

    Key range locks are similar to row locks on index keys (whether clustered or not). The locks are placed on individual keys rather than at the node level. The hash value consists of all the key ...

    php操作SqlServer数据库练习.rar

    echo "Connection could not be established. "; die(print_r(sqlsrv_errors(), true)); } ``` 2. **查询操作(SELECT)** 使用`sqlsrv_query`函数执行SQL查询,例如获取所有用户信息: ```php $sql = ...

    WMI的VC基本操作方法

    std::cout &lt;&lt; "Failed to execute query. Error code=0x" ; pSvc-&gt;Release(); pLoc-&gt;Release(); CoUninitialize(); return 1; // 程序失败。 } // 这里省略了遍历结果集和解析数据的部分 ``` 以上步骤展示了...

    php采用ms官方扩展pdo方式连接高版本mssql需要sqlncli

    echo "Connection could not be established. "; die( print_r( sqlsrv_errors(), true)); } ?&gt; ``` 4. 预处理和执行SQL语句:利用PDO的预处理能力,可以编写安全的SQL查询,防止SQL注入攻击。例如: ```php ...

    google api php client

    Once composer is installed, execute the following command in your project root to install this library: ```sh composer require google/apiclient:"^2.0" ``` Finally, be sure to include the autoloader:...

    PHP连接MSSQL2005的扩展插件.

    echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true)); } /* Get the product picture for a given product ID. */ $tsql = "SELECT LargePhoto FROM Production.ProductPhoto AS p JOIN ...

    [应用开发及迁移][客户端编程接口]Perl-DBI指南.pdf

    or die "Could not connect to database: " . DBI-&gt;errstr; # 准备SQL查询 my $sth = $dbh-&gt;prepare("SELECT * FROM mytable"); # 执行查询 $sth-&gt;execute(); # 获取结果集 my @results; while (my $row = $sth-...

Global site tag (gtag.js) - Google Analytics