I have a domain entity class with the property:
public virtual double? Result { get; set; }
The property is converted using NHibernate 3.2 type display material:
public class SampleResultMap : ClassMapping<SampleResult> { public SampleResultMap() { Id(c => c.Id, map => map.Generator(Generators.Identity)); Property(c => c.Result, map => { map.NotNullable(false); });
This works fine, and the SQL Server 2008 R2 table is correctly created with the float data type.
However, a call to SchemaValidator.Validate raises this error:
NHibernate.HibernateException was unhandled Wrong column type in Foo.dbo.SampleResult for column Result. Found: float, Expected DOUBLE PRECISION
If you look at the SQL invoked by the call to SchemaExport.Create , this is the definition for the table:
create table SampleResult ( Id INT IDENTITY NOT NULL, DateEnteredUtc DATETIME not null, ElementId INT not null, Unit INT not null, ResultText NVARCHAR(50) null, [Result] DOUBLE PRECISION null, Detected BIT not null, Qualifier NVARCHAR(10) null, SampleId INT not null, Deleted BIT not null, primary key (Id) )
From a quick read of NHibernate 3.2 sources, it seems that the validator compares "DOUBLE PRECISION" with "float".
Has anyone else seen this? I suppose this is a mistake, but I did not use the validator before I wanted to find out if I was doing something wrong.