Not.Nullable() doesn’t affect output schema for non

sadomovalex's Avatar

sadomovalex

08 May, 2010 10:55 AM via web

Hello
I'm using fluent nhibernate v. 1.0.0.595. There is a class:

public class Weight
{

public virtual int Id { get; set; }
public virtual double Value { get; set; }

}

I want to map it on the following table:

create table [Weight] (

WeightId INT IDENTITY NOT NULL,

Weight DOUBLE not null, primary key (WeightId) )

Here is the map:

public class WeightMap : ClassMap
{

public WeightMap()
{
    Table("[Weight]");
    Id(x => x.Id, "WeightId");
    Map(x => x.Value, "Weight").Not.Nullable();
}

}

The problem is that this mapping produces table with nullable Weight column:

Weight DOUBLE null

Not-nullable column is generated only with default convention for column name (i.e. Map(x => x.Value).Not.Nullable() instead of Map(x => x.Value, "Weight").Not.Nullable()), but in this case there will be Value column instead of Weight:

create table [Weight] (

WeightId INT IDENTITY NOT NULL,

Value DOUBLE not null, primary key (WeightId) )

I found similiar problem here: http://code.google.com/p/fluent-nhibernate/issues/detail?id=121, but seems like mentioned workaround with SetAttributeOnColumnElement("not-null", "true") is outdated. Does anybody encountered with this problem? Is there a way to specify named column as not-nullable?

  1. Support Staff 2 Posted by James Gregory on 16 May, 2010 05:08 PM

    James Gregory's Avatar

    Can't reproduce with the latest version. Try updating to the latest, and failing that please supply us with a failing example.

  2. 3 Posted by sadomovalex on 05 Jun, 2010 12:25 PM

    sadomovalex's Avatar

    I confirm that it was fixed in latest release (1.0.0.663)

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What comes next? 'Monday Tuesday Wednesday ?????'