Blog Stats
  • Posts - 62
  • Articles - 1
  • Comments - 35
  • Trackbacks - 76

 

Discriminators in NHIbernate

I had just wrestled with dealing with an NHibernate exception that was beyond useless since I KNEW that my mappings were good . I had used Nhibernates's hbm2ddl tool to generate schema for some tables. The output for one of my tables was as follows:
create table eMerge.dbo.MaterialTest (Id INT IDENTITY NOT NULL, TypeCode NVARCHAR(255) not null, Name NVARCHAR(255) null, Description NVARCHAR(255) null, MaterialTestAgencyId INT null, primary key (Id)) c
If the TypeCode field is used for my discriminator what is the problem wit hthis output? Using NVarchar! THis happened a week ago and then I saw this post on Ayende's blog where he tackled the same thing. He also proposes a best practice to avoid this.
Really, I need to just specify the type in the mapping file to avoid this kind of thing when automating my ddl.

Feedback

No comments posted yet.


Post a comment





 

Please add 2 and 3 and type the answer here:

 

 

Copyright © Mike Nichols