|
From: <ric...@us...> - 2009-10-30 10:55:45
|
Revision: 4808
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4808&view=rev
Author: ricbrown
Date: 2009-10-30 10:55:36 +0000 (Fri, 30 Oct 2009)
Log Message:
-----------
Merge r4807 (Fix NH-2003, not null constraint on identifier column)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassIdBinder.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Model.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassIdBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassIdBinder.cs 2009-10-30 10:54:56 UTC (rev 4807)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassIdBinder.cs 2009-10-30 10:55:36 UTC (rev 4808)
@@ -234,7 +234,7 @@
if (columnSchema.length != null)
column.Length = int.Parse(columnSchema.length);
- column.IsNullable = columnSchema.notnullSpecified ? columnSchema.notnull : false;
+ column.IsNullable = columnSchema.notnullSpecified ? !columnSchema.notnull : false;
column.IsUnique = columnSchema.uniqueSpecified && columnSchema.unique;
column.CheckConstraint = columnSchema.check ?? string.Empty;
column.SqlType = columnSchema.sqltype;
Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003
___________________________________________________________________
Added: bugtraq:url
+ http://jira.nhibernate.org/browse/%BUGID%
Added: bugtraq:logregex
+ NH-\d+
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Fixture.cs 2009-10-30 10:55:36 UTC (rev 4808)
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using NHibernate.Cfg;
+using NHibernate.Tool.hbm2ddl;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH2003
+{
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+ [Test]
+ public void ShouldCreateNotNullIdColumn()
+ {
+ StringBuilder script = new StringBuilder();
+
+ Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(MappingsAssembly + "." + (string)Mappings[0]))
+ cfg.AddInputStream(stream);
+ new SchemaExport(cfg).Execute(s => script.AppendLine(s), false, false);
+
+ string wholeScript = script.ToString();
+ Assert.That(wholeScript.ToLower(), Text.Contains("not null"));
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Mappings.hbm.xml 2009-10-30 10:55:36 UTC (rev 4808)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ namespace="NHibernate.Test.NHSpecificTest.NH2003"
+ assembly="NHibernate.Test">
+
+ <class name="MyClass">
+ <id name="Id">
+ <column name="IdColumn" not-null="true"/>
+ <generator class="hilo" />
+ </id>
+ </class>
+</hibernate-mapping>
+
+
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Model.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Model.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2003/Model.cs 2009-10-30 10:55:36 UTC (rev 4808)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+
+namespace NHibernate.Test.NHSpecificTest.NH2003
+{
+ public class MyClass
+ {
+ public virtual int Id { get; set; }
+ }
+}
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-30 10:54:56 UTC (rev 4807)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-30 10:55:36 UTC (rev 4808)
@@ -637,6 +637,8 @@
<Compile Include="NHSpecificTest\NH1985\SampleTest.cs" />
<Compile Include="NHSpecificTest\NH1990\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1990\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2003\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2003\Model.cs" />
<Compile Include="NHSpecificTest\NH473\Child.cs" />
<Compile Include="NHSpecificTest\NH473\Fixture.cs" />
<Compile Include="NHSpecificTest\NH473\Parent.cs" />
@@ -2050,6 +2052,7 @@
<EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" />
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2003\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1356\MappingsBag.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1356\MappingsList.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1356\MappingsSet.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|