House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Trapping entityDelete() errors

  << Previous Post |  RSS |  Subscribe to this Group Next >> 

Trapping entityDelete() errors

Working with ColdFusion 9 ORM, is there a way to trap entityDelete() errors when Ryan Heldt 12/22/2010 02:01 PM

12/22/2010 02:01 PM
Author: Ryan Heldt Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:62393#340211 Working with ColdFusion 9 ORM, is there a way to trap entityDelete() errors when there's a constraint violation. I have my delete setup like so: try {        entityDelete(local.objSongCategory);        // report success } catch (Any e) {        transaction action="rollback";        // report fail } However, if I attempt to delete a record in use (a song assigned to category being deleted), CF throws an error: coldfusion.orm.hibernate.HibernateSessionException: Cannot delete or update a parent row: a foreign key constraint fails (`databasename`.`songs`, CONSTRAINT `songs_ibfk_3` FOREIGN KEY (`SongCategoryID`) REFERENCES `songcategories` (`SongCategoryID`)). (Database) I'm a little puzzled why the error isn't being caught since the delete is occurring inside a try/catch. Any thoughts?
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

October 23, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference