ORA-02291: violation of complete constraints ...... -The parent keyword is not found.

Source: Internet
Author: User

Error
Caused by: org. hibernate. exception. ConstraintViolationException: cocould not execute JDBC batch update
ORA-02291: violation of complete constraints (UNISPOWER. FK932556A9840256A3)-parent keyword not found

Possible causes
A field in Table A is A foreign key associated with A field in Table B. This situation occurs when data is inserted into Table.

Possible causes:
1. When inserting data into Table A, the field associated with the foreign key must have data in Table B. This is the case if Table B does not have data.

2. A foreign key ring is generated, that is, the field associated with the foreign key in Table B is associated with the field in table C, but the corresponding field in Table C does not have data.
3. If it is not the above two cases, it is A very easy to neglect problem: the data type and length of the foreign key field in A and the field associated with the foreign key in B are inconsistent. In particular, the data length must be consistent.

The length of the Data Type in the master table and slave table is different.
It runs normally in Hibernate + spring and has problems with springRMI.
Cocould not execute JDBC batch update; nested exception is
ORA-02291: violation of complete constraints (UNISPOWER. FK59EE1CFB72ACDA11)-parent keyword not found

My reasons:
The id attribute settings of ing object classes are automatically generated. The program has a statement that assigns a value to the id, causing the id value when the table is inserted, and the reference id value assigned to the associated table below is not always.
The above error occurs, because the id value in the substation table is automatically generated. Of course, it is different from the id value I assigned in the program, the bay and so on are all used as reference Foreign keys based on the id value given in my program.
This problem is really not found online ......
Modify the id settings attribute in the **. hbm. xml file.

<Id
Name = "id"
Column = "SUBSTATION_ID"
Type = "java. lang. Long"
Unsaved-value = "-1"
>
<Generator class = "assigned">
</Generator>
</Id>

The original generator is always native, which means that the appropriate automatic id generation policy is automatically selected based on the underlying database.
The current assigned indicates that the application assigns a identifier to the object before calling save. In fact, if you do not specify generator, This is the default type. It's really an idiot !!

This generator uses a natural key (natural key, commercial column-) as the primary key, rather than a proxy key (surrogate key, non-commercial column- ). This is the default action when no <generator> element is specified.
[Note] when selecting the assigned generator, unless there is a version or timestamp attribute, Or you define
Interceptor. isUnsaved (). Otherwise, the Hiberante must be forced to use unsaved-value = "undefined ".
Hibernatet queries the database to determine whether an instance is transient or detached ).

SPFILE error causing database startup failure (ORA-01565)

ORA-01172, ORA-01151 error handling

ORA-00600 [2662] troubleshooting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.