Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Database - Interview Questions and Answers for 'Constraintviolationexception' - 2 question(s) found - Order By Newest | ||||
| ||||
| Ans. Application is unable to insert a record as it violates a unique constraint. The exception states the constraint and Table can be located by the Entity mapping. So I will go to the DB and will first check to which all columns the unique constraint applies. And then I will go and check the code and logs to see how come the duplicate column values were attempted to be inserted when they were not supposed to be. | ||||
| ||||
| Ans. The exception is thrown when a database constraint is violated. | ||||
org.hibernate.exception.ConstraintViolationException: could not insert: [<Entity>] Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (<Constraint Name>) violated and how would you go about debugging it ? | ||||