1. 程式人生 > >異常:Batch update returned unexpected row count from update [0]; actual row count: 0;

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

ctr property actual false per rop col rom pro

使用了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);
}
從而出現異常了

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