Hibernate operation:could not execute JDBC batch update; SQL [INSERT INTO
Dchnpricecarchancesource (inpricecard_id, pricecard_id, Count, Sumcount, Source_code, Reason_code,
ingroup_id, Op_login, Op_groupid, Op_time, Change_source, Memo1, Memo2, change_id) VALUES (?,?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; Ora-02291:integrity constraint
(Dbchnadm. fk_dchnpric_reference_dchnpric) violated-parent key not found; Nested exception is
Java.sql.batchupdateexception:ora-02291:integrity constraint
(Dbchnadm. fk_dchnpric_reference_dchnpric) violated-parent key not found
--------------------------------------------------------------------------------------------------------------- ------------
See the eighth chapter of the book:
Oracle Database 11g SQL Development Guide <oracle Database 11g SQL Master SQL and pl/sql in the Oracle database>
8.5.2 FOREIGN KEY constraint
A foreign-key relationship is a column in one table that references a column in another table. For example, the product_type_id column in the Products table references the
Product_types the product_type_id column in the table. The Product_types table is called the parent table, and the Products table is called the child
Table (child table) because the product_type_id column in the Products table relies on the product_type_id in the Product_types table
Column.
If you try to insert a row into the Products table, but the product_type_id of this row does not exist, the database returns a ORA-02291 error. This mistake
Error description The database could not find a matching parent key value (where the parent key is the product_type_id column in the Product_types table). In the following
example, this error is returned because a row with product_type_id 6 does not exist in the Product_types table:
Sql> INSERT into the products (
2 product_id, product_type_id, name, description, price
3) VALUES (
4, 6, ' Test ', ' Test ', NULL
5);
INSERT into the products (
*
ERROR at line 1:
Ora-02291:integrity constraint (STORE. Products_fk_product_types)
Violated-parent Key not found
Similarly, if you attempt to set the product_type_id column of a row in the Products table to a nonexistent parent key value, the database returns the same
Error. For example:
Sql> UPDATE Products
2 SET product_type_id = 6
3 WHERE product_id = 1;
UPDATE Products
*
ERROR at line 1:
Ora-02291:integrity constraint (STORE. Products_fk_product_types)
Violated-parent Key not found
If you attempt to delete a row that already has dependent child rows from the parent table, the database returns a ORA-02292 error. For example, if you try to delete
The product_type_id column in the Product_types table is a row of 1, and the database returns a ORA-02292 error because the Products table contains
product_type_id column equals 1 line:
Sql> DELETE from Product_types
2 WHERE product_type_id = 1;
DELETE from Product_types
*
ERROR at line 1:
Ora-02292:integrity constraint (STORE. Products_fk_product_types)
Violated-child Record found
If the database allows this deletion to take effect, then the child rows are invalid because they cannot point to valid values in the parent table.
--------------------------------------------------------------------------------------------------------------- ------
Later found to be in the table of the foreign key set error caused by the warning:
Turn from: http://hi.baidu.com/skyforum/blog/item/37611a2e25a8205a4ec2262f.html