There was a problem when I encountered the modulation code today, that is, After I deleted all the records of the database, I registered through the registration page of the front page.
But SQL Error: 1452, SQLState: 23000; Other errors are as follows:
[tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
the 2017-03-31 12:27:35 [tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [insert into user_role (nickName, role_id) values (?, ?)] ; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch
This error occurs because the foreign key is null, so an error is reported. Because it’s a test database, there’s nothing important in it so I just delete the database and restart the project and create the table.
Solution: first check the relationship of their own table, can be set in the background through the set method, or directly in the database to add this foreign key; One more thing is not to delete the library!!
But SQL Error: 1452, SQLState: 23000; Other errors are as follows:
[tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
the 2017-03-31 12:27:35 [tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [insert into user_role (nickName, role_id) values (?, ?)] ; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch
This error occurs because the foreign key is null, so an error is reported. Because it’s a test database, there’s nothing important in it so I just delete the database and restart the project and create the table.
Solution: first check the relationship of their own table, can be set in the background through the set method, or directly in the database to add this foreign key; One more thing is not to delete the library!!
Read More:
- DB2 SQL ERROR: SQLCODE=-803, SQLSTATE=23505, SQL
- SQL Error: 17059, SQLState: 99999
- SQL Error: 0, SQLState: 08S01 & Communications link failure
- SQL Error: 904, SQLState: 42000
- Solve a bug harvest of DB2 (sqlcode = – 805, sqlstate = 51002, error message = DB2 SQL error: sqlcode = – 805, sqlstate = 5100
- DB2 SQL error: sqlcode = – 803, sqlstate = 23505, sqlerrmc = 2 [solution]
- SQL error: 17006, sqlstate: 99999 invalid column name
- DB2 SQL error: SQLCODE: -433, SQLSTATE: 22001, SQLERRMC
- DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
- DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;,?,?,?,?,?,?,?,?);END-OF-STATEMENT
- DB2 SQL error: sqlcode = – 433, sqlstate = 22001 solved
- How to Fix SQL Error: 1054, SQLState: 42S22 Unknown column ‘markcardex0_.art_service_time’ in ‘field list’
- Error when connecting to database: DB2 SQL error: sqlcode = – 204, sqlstate = 42704, sqlerrmc= YXUAT.CUST_ BLK_ REL, DRIVER=4.25.13
- SQL error: 156, sqlstate: S1000 error encountered in Hibernate
- Log error SQL Error: 1062, SQLState: 23000
- ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS sqlState
- Spring data JAP SQL error:17059 SQL State:99999
- SQLCODE=-551, SQLSTATE=42501 error resolution
- Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the
- SAP SQL error “SQL code: -10692“ occurred while accessing table “ZTXXXX“.