Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. AbstractEntityPersister.delete() has thrown a ConstraintViolationException
    Hibernate Core
    0
    1
    0
  2. PreparedStatement.executeInternal() has thrown a MySQLIntegrityConstraintViolationException
    MySQL Connector/J
    104
    130
    23

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`atreference2_5_3`.`patronvisitsresources`, CONSTRAINT `FKAAE25A2F53ACD5C3` FOREIGN KEY (`resourceId`) REFERENCES `resources` (`resourceId`))
11 matching frames hidden
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
2 frames hidden

Solution

chinthana10 months ago

Nothing is wrong with the database. When it gives you those errors, it's telling you that you are trying to input "nothing" (null) into a column that doesn't allow it. Fix it by removing the not null constraint or by passing a value to that field.

External results for this pattern (10)

  1. Jonathan Pricevia Google Groups1 week ago
    Could not execute JDBC batch update
    Show stack trace
  2. 吴冉波via Google Groups1 week ago
    Duplicate entry '115-67' for key 'permission_permission_meta_resource_uniq'
    Show stack trace
  3. TTTimWangvia GitHub1 month ago
    Column 'gift_id' cannot be null ; SQL []; Column 'gift_id' cannot be null; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'gift_id' cannot be null
    Show stack trace
  4. cdmvirtvia GitHub1 month ago
    Cannot add or update a child row: a foreign key constraint fails (`mobhunting`.`mh_Bounties`, CONSTRAINT `mh_Bounties_Player_Id_1` FOREIGN KEY (`BOUNTYOWNER_ID`) REFERENCES `mh_Players` (`PLAYER_ID`) ON DELETE CASCADE)
    Show stack trace
  5. hh6plusvia Stack Overflow2 months ago
    Duplicate entry '2750633-163072083-袋-0' for key 'uk_unit_name'
    Show stack trace
  6. Jon Snowvia Stack Overflow2 months ago
  7. cthielenvia GitHub3 months ago
    could not execute statement; SQL [n/a]; constraint [sectionGroup_unique_courseId_termCode]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    Show stack trace
  8. ltwheelervia GitHub3 months ago
    could not execute statement; SQL [n/a]; constraint [TeachingCall_Instructor_TermCode]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    Show stack trace
  9. ltwheelervia GitHub3 months ago
    could not execute statement; SQL [n/a]; constraint [TeachingCall_Instructor_TermCode]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    Show stack trace