wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException" Watch "Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException" New topic
Author

Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 60
I am Implementing a ModelDriven interface with its getModel() mehtod in Action class and passing an object of an bean(POJO) class
to save the bean object into DAO class with passing this object to method but it thrown an Exception like that



Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot add or update a child row:
a foreign key constraint fails (`changedftts/capabilitybuilding`, CONSTRAINT `FK_capabilitybuilding_2` FOREIGN KEY (`mentorID`)
REFERENCES `mentor` (`mentorID`) ON DELETE CASCADE ON UPDATE CASCADE)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1729)

what is reason for thrown an 'MySQLIntegrityConstraintViolationException'.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException
 
Similar Threads
Problem with Enums
Simple But Crazy Cascade Problem
Cannot add or update a child row: a foreign key constraint fails
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException
Hibernate 3.0 : Where am I going wrong?