File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 67
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'.
 
 
subject: Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException
 
Similar Threads
Cannot add or update a child row: a foreign key constraint fails
Simple But Crazy Cascade Problem
Hibernate 3.0 : Where am I going wrong?
Problem with Enums
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException