Help with errors : "this may indicate a bug in NHibernate or in your custom types."

Topics: Customizing Orchard
Feb 6, 2014 at 10:28 AM
Edited Feb 6, 2014 at 10:41 AM
Hello All,

I need help with strange behavior of Orchard.ContentManagement.Records.ContentTypeRecord

I have very simple content record & part in my migration class
SchemaBuilder.CreateTable("PaymentServiceRecord", table =>
                     .Column<string>("ServiceName", col => col.NotNull().WithLength(150)));

 ContentDefinitionManager.AlterPartDefinition(typeof(PaymentServicePart).Name, config =>
               config.WithField("ServiceUri", field => field.OfType("LinkField").WithDisplayName("Service URI"))
                     .WithDescription("Describe payment services for active sign platform")
after that i defined custom content type so:
ContentDefinitionManager.AlterTypeDefinition("PaymentService", builder =>
                                                                                  .DisplayedAs("Payment Service"));
My handler & driver for thouse created with very standart and simple way. (if need i can add code too.)

After add my modules via dashboard i don't get any errors, but when i go to create PaymentService item i get errors [by logs]:

2014-02-06 12:53:09,321 [14] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'ServiceName', table 'PaymentServiceRecord'; column does not allow nulls. INSERT fails.
The statement has been terminated.

2014-02-06 12:53:11,300 [14] NHibernate.AssertionFailure - An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types.
NHibernate.AssertionFailure: null id in Orchard.ContentManagement.Records.ContentTypeRecord entry (don't flush the Session after an exception occurs)


1) Whats my wrong on define record, part or contenttype ?

2) I can to define fields with NotNull setting ?

Thanks for help!