异常:Batch update returned unexpected row count from update [0]; actual row count: 0;

使用了hibernate的主键生成策略,而在程序中又主动去设置了主键值。<class name="ProductRegion" table="PRODUCT_REGION" lazy="false">
        <id name="id" column="PRODUCT_REGION_ID">
            <generator class="native" />
        </id>    
        <many-to-one class = "gira.domain.place.Region" name="region" column="PRODUCT_REGION_REGION_ID" />
        <many-to-one class = "Product" name="product" column="PRODUCT_REGION_PRODUCT_ID" ></many-to-one>
        <property name="index" column="PRODUCT_REGION_INDEX" />
</class>

程序中:
for(Long l:regionIds){
                Region region=regionDao.findById(l);
                ProductRegion productRegion=new ProductRegion();
                productRegion.setProduct(product);
                productRegion.setRegion(region);
                productRegion.setId(i);
                i++;
                productRegions.add(productRegion);
}
从而出现异常了

时间: 2024-12-18 12:03:20

异常:Batch update returned unexpected row count from update [0]; actual row count: 0;的相关文章

关于Hibernate级联更新插入信息时提示主键不为空的问题“org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 ”

org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 出现这一错误的主要原因有两个       使用的是hibernate的saveOrUpdate方法保存实例.saveOrUpdate方法要求ID为null时才执行SAVE,在其它情况下执行UPDATE.在保存实例的时候是新增,但你的ID不为null,

关于Error during managed flush [Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1]错误

控制台报错: 08:07:09.293 [http-bio-8080-exec-2] ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1] 查阅许多博客得出了自己的理解,请大家指教: 由于存在隐藏表单进

select * from salgrade for update和select * from salgrade for update nowait区别

1,select * from salgrade for update session1 session2 SQL> delete salgrade where grade=1; 1 row deleted.     SQL> select * from salgrade for update; 此时session2被阻塞 SQL> rollback; Rollback complete.            GRADE    LOSAL       HISAL ----------

Error Code: 1175 You are using safe update mode and you tried to update a table without a WHERE that

转载自: http://blog.csdn.net/amohan/article/details/9980315 快速高效用:SET SQL_SAFE_UPDATES = 0:下面的就不要看了! 今日用MySQL Workbench进行数据库的管理更新时,执行一个更新的语句碰到以下错误提示: Error Code: 1175 You are using safe update mode and you tried to update a table without a WHERE that us

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE

1 错误描写叙述 19:15:34 call sp_store_insert(90) Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.0

mysql错误:Error Code: 1175. You are using safe update mode and you tried to update a table……

今天遇到一个mysql错误: Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect. 网上查了一下,原来是SET SQL_SAFE_UPDATES

eclipse Run On Server 异常:could not load the Tomcat Server configuration at Servers\tomcat V5.0 Sertomcat

eclipse Run On Server 异常:could not load the Tomcat Server configuration at Servers\tomcat V5.0 Sertomcat无法运行 servce运行不了的问题解决 :first-child { margin-top: 0; } blockquote > :last-child { margin-bottom: 0; } img { border: 0; max-width: 100%; height: auto

mysql update 报 You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode

UPDATE i18nresource SET languageId = 'en-us' Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect. 

Error Code: 1175. You are using safe update mode and you tried to update a table

错误描述 11:14:39 delete from t_analy_yhd Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.000 se