Applying updates using SchemaEditor fail with the error "Could not save object" (Article # 282)
View products that this article applies to.
Problem:
Applying schema changes to MS SQL Server 2005 databases using SchemaEditor can sometimes fail when adding a new table having a relation.
The failure will result in the error message "Error Occurred : Could not save object"
Here is an example of what the logging output looks like:
INFO Dovetail.SchemaEditor.UI.Console.ApplyVerb - An error occurred while applying schema changes to the database. Your database may be in an inconsistent state. It is highly recommend that you restore your database (you did back up, right?).
ERROR Dovetail.SchemaEditor.UI.Console.ConsoleController - Error Occurred : Could not save object
...
NHibernate.ADOException: Could not save object ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Dovetail.DataDictionary.Persistence.Database.RelationDto.GetHashCode()
at NHibernate.Engine.Key.GetHashCode()
Resolution:
The cause of the problem seems to be an incompatibilty between a data acess library being used by SchemaEditor and .Net 2.0. This problem has been fixed as of service pack 1 of the .Net 2.0 framework.
If you run into this problem please update the .Net 2.0 framework to service pack 1 or greater.
Do an Internet search for: Microsoft .Net 2.0 SP1 download
Resolution:
Because this issue only occurs when adding a table to the scheme and adding relations to that table within one schema update. You can split the update into two parts. Add the schema table and all its columns in the first update. Then, add the relation in a second update.
Applies To: