Hello
I am trying to map a hierarchy as table per class, and I'm getting the
following exception:
NHibernate: INSERT INTO ResourceBases DEFAULT VALUES; select
last_insert_rowid()
TestCase
'Smack.ConstructionAdmin.Tests.Data.MappingTests.ResourceMappingTests.CanSaveAndLoad_StaffMemberResource'
failed: NHibernate.Exceptions.GenericADOException : could not insert:
[Smack.ConstructionAdmin.Domain.Model.Resources.StaffMemberResource]
[SQL: INSERT INTO ResourceBases DEFAULT VALUES; select
last_insert_rowid()]
----> System.Data.SQLite.SQLiteException : Abort due to constraint
violation
ResourceBases.ResourceType may not be NULL
ResourceType is my Discriminator column as defined in the following
mapping override:
public class ResourceBaseMap : IAutoMappingOverride<ResourceBase>
{
public void Override(AutoMapping<ResourceBase> m)
{
m.IgnoreProperty(x => x.Name);
m.IgnoreProperty(x => x.BusinessId);
m.IgnoreProperty(x => x.OrganizationName);
m.DiscriminateSubClassesOnColumn("ResourceType").Length
(255);
m.HasMany(x => x.Allocations).AsSet();
}
}
public class StaffMemberResourceMap :
IAutoMappingOverride<StaffMemberResource>
{
public void Override(AutoMapping<StaffMemberResource> m)
{
m.References(x => x.StaffMember);
}
}
My understanding is that the value in the discriminator column will
default to the full class name of the subclass, but SQLite seems to
think it's getting a NULL value instead.
Can someone please enlighten me as to how I'm abusing my mapping to
get this error?
Thanks,
Berryl
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en.