Tag Archive for 'hibernate'

Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for XXX —> NHibernate.Exceptions.GenericADOException: could not delete collection

The beginning of the stack trace I got today looked as below:

2009-05-19 11:01:45,078 ERROR [5232] XXX - Speaker already deleted: Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for Speaker ---> NHibernate.Exceptions.GenericADOException: could not delete collection: [XXX#XXX][SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'SpeakerId', table 'XXX.dbo.lnk_Session_Speaker'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
   ...
   at SpeakerProxy3e9fd3b0e82745c2b91b8a353acaa93d.DeleteAndFlush()

Background

I had three tables and classes representing them: Session / app_Session, Speaker / app_Speaker, and SessionSpeaker / lnk_Session_Speaker.

Continue reading ‘Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for XXX —> NHibernate.Exceptions.GenericADOException: could not delete collection’