title: Fluent NHibernate: mapping property "Length" ignored when inserting or updating
body: <p>we are trying to (slowly) migrate all our programs from Delphi to C#, and its our first time with an ORM, so please forgive if the question may be silly. ;-)</p>
  
  <p>We are using:</p>
  
  <ul>
  <li>DB2 Version 9.7.5</li>
  <li>FluentNHibernate Version 1.3.0.0</li>
  <li>NHibernate Version 3.3.1.4000</li>
  </ul>
  
  <p>For our unit test project, I got the entity "TestCSharp" defined. This type has a string property named "TextVar". Here is the mapping:</p>
  
  <pre><code>public class TestCsharpMapping:ClassMap&lt;TestCsharp&gt;
  {
    /// &lt;summary&gt; 
    /// map constructor
    /// &lt;/summary&gt;
    public TestCsharpMapping()     
    {
       Schema("TEST");
       Table("TEST_CSHARP");
       base.Id(x =&gt; x.Id).Column("ID").GeneratedBy.Sequence("ID_SEQUENCE");
       Map(x =&gt; x.TextVar).Column("TEXT_VAR").Nullable().Length(20);
    }
  
  }
  </code></pre>
  
  <p>The table TEST.TEST_CSHARP resides on a linux DB2 database, the field TEXT_VAR is a VARCHAR(20) field.</p>
  
  <p>This is my unit test (the hibernate session itself is encapsulated by a wrapper type we are designing, so dont you wonder):</p>
  
  <pre><code>  [TestMethod]
    public void TestEditTextFields()
    {
       ReInitSession();
       CleanUp();
       var testobjects = _dataProviderSession.LoadAll&lt;TestCsharp&gt;(QueryDuration.ShortQuery);
       testobjects.Add( new TestCsharp());
       // overflow : Text_Var is only 20 chars long
       testobjects[0].TextVar = "01234567890123456789A";
       _dataProviderSession.Save();
       testobjects = _dataProviderSession.LoadAll&lt;TestCsharp&gt;(QueryDuration.ShortQuery);
       Assert.AreEqual(1, testobjects.Count);
       Assert.AreEqual("01234567890123456789", testobjects[0].TextVar);
    }
  </code></pre>
  
  <p>The unit test is failing at the Save() command with a DB2 error "IBM.Data.DB2.DB2Exception: ERROR [22001] [IBM] CLI0109E  Zeichenfolge rechts abgeschnitten." (which is german for "string right truncated"). Assigning a string value with a length less or equal to 20 characters leads to no exception.</p>
  
  <p>So what is it I am missing? The Length property doesn´t seem to have any functional impact. I was assuming that the call "Length(20)" would cause the ORM to cut the string down to 20 characters when saving (just as Borlands Delphi did when setting the size of field components inside datasets).  :-/</p>
  
  <p>Any hints are welcome! </p>
  
  <p>Kind regards</p>
  
  <p>Andreas</p>