Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

  1. ,

    Check whether privilege has the "not null" restriction. If so it always has to have a value and can never be null.

    A different reason could be a wrong implementation of a foreign key. Check whether you always correctly insert/update in both tables.

  2. ,

    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.

Solutions on the web

via Stack Overflow by Mykhailo Seniutovych
, 1 year ago
Cannot add or update a child row: a foreign key constraint fails (`grades_book_db`.`grades`, CONSTRAINT `FK_Grades_Subject` FOREIGN KEY (`Subject_Id`) REFERENCES `subjects` (`Subject_Id`))
via Stack Overflow by nbro
, 2 years ago
Column 'registered_user_username' cannot be null
via Stack Overflow by Milos Vulic
, 4 months ago
Cannot add or update a child row: a foreign key constraint fails (`projekatbaze`.`pesmica`, CONSTRAINT `pesmica_ibfk_1` FOREIGN KEY (`id_album`) REFERENCES `album` (`id_album`) ON DELETE CASCADE ON UPDATE NO ACTION)
via Stack Overflow by Romil Jain
, 1 year ago
Duplicate entry 'owner1:warehouseid1:skuid98238:08-11-2016' for key 'PRIMARY'
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`grades_book_db`.`grades`, CONSTRAINT `FK_Grades_Subject` FOREIGN KEY (`Subject_Id`) REFERENCES `subjects` (`Subject_Id`))	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)	at java.lang.reflect.Constructor.newInstance(Unknown Source)	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)	at com.mysql.jdbc.Util.getInstance(Util.java:408)	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)	at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5098)	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)