com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException

Cannot add or update a child row: a foreign key constraint fails (`cas`.`SERVICETICKET`, CONSTRAINT `FK(TGTID)` FOREIG N KEY (`ticketGrantingTicket_ID`) REFERENCES `TICKETGRANTINGTICKET` (`ID`))

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web574

  • via Unknown by Jeffrey Wong,
  • via GitHub by simplechen
    ,
  • via GitHub by xiegengcai
    ,
  • Stack trace

    • com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`cas`.`SERVICETICKET`, CONSTRAINT `FK(TGTID)` FOREIG N KEY (`ticketGrantingTicket_ID`) REFERENCES `TICKETGRANTINGTICKET` (`ID`)) at sun.reflect.GeneratedConstructorAccessor131.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.Util.getInstance(Util.java:387) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:932) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073) at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1751) at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1257) at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:959) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544) at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:110) at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:97) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:147) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch(JdbcCoordinatorImpl.java:214) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:470)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    slashslash
    9 times, last one
    tvrmsmithtvrmsmith
    22 times, last one
    Unknown UserUnknown User
    18 times, last one
    MattyMatty
    4 times, last one
    AxeloAxelo
    5 times, last one
    61 more bugmates