|
From: <fab...@us...> - 2010-03-15 16:06:18
|
Revision: 4956
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4956&view=rev
Author: fabiomaulo
Date: 2010-03-15 16:06:07 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
Fix NH-2137
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ValuePropertyBinder.cs
trunk/nhibernate/src/NHibernate.Test/App.config
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.cs
trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.hbm.xml
trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToManyTest.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ValuePropertyBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ValuePropertyBinder.cs 2010-03-07 10:16:09 UTC (rev 4955)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ValuePropertyBinder.cs 2010-03-15 16:06:07 UTC (rev 4956)
@@ -133,7 +133,7 @@
public void BindSimpleValue(HbmListIndex listIndexMapping, string propertyPath, bool isNullable)
{
new TypeBinder(value, Mappings).Bind(NHibernateUtil.Int32.Name);
- new ColumnsBinder(value, Mappings).Bind(listIndexMapping.Columns, false,
+ new ColumnsBinder(value, Mappings).Bind(listIndexMapping.Columns, isNullable,
() =>
new HbmColumn
{
Modified: trunk/nhibernate/src/NHibernate.Test/App.config
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/App.config 2010-03-07 10:16:09 UTC (rev 4955)
+++ trunk/nhibernate/src/NHibernate.Test/App.config 2010-03-15 16:06:07 UTC (rev 4956)
@@ -126,7 +126,7 @@
</logger>
<logger name="NHibernate.SQL">
- <level value="OFF" />
+ <level value="DEBUG" />
</logger>
<logger name="NHibernate.AdoNet.AbstractBatcher">
Added: trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.cs 2010-03-15 16:06:07 UTC (rev 4956)
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+
+namespace NHibernate.Test.ListIndex
+{
+ public class Image
+ {
+ public virtual int Id { get; set; }
+ public virtual string Path { get; set; }
+ }
+
+ public class Galery
+ {
+ public Galery()
+ {
+ Images = new List<Image>();
+ }
+ public virtual int Id { get; set; }
+
+ public virtual IList<Image> Images { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToMany.hbm.xml 2010-03-15 16:06:07 UTC (rev 4956)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.ListIndex">
+ <class name="Image">
+ <id name="Id">
+ <generator class="hilo"/>
+ </id>
+ <property name="Path"/>
+ </class>
+
+ <class name="Galery">
+ <id name="Id">
+ <generator class="hilo"/>
+ </id>
+ <list name="Images" cascade="all">
+ <key column="img_key"/>
+ <list-index column="imgIdx"/>
+ <one-to-many class="Image"/>
+ </list>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToManyTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToManyTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/ListIndex/SimpleOneToManyTest.cs 2010-03-15 16:06:07 UTC (rev 4956)
@@ -0,0 +1,39 @@
+using System.Collections;
+using NUnit.Framework;
+
+namespace NHibernate.Test.ListIndex
+{
+ [TestFixture]
+ public class SimpleOneToManyTest : TestCase
+ {
+ protected override IList Mappings
+ {
+ get { return new string[] { "ListIndex.SimpleOneToMany.hbm.xml" }; }
+ }
+
+ protected override string MappingsAssembly
+ {
+ get { return "NHibernate.Test"; }
+ }
+
+ [Test]
+ public void ShouldIncludeTheListIdxInserting()
+ {
+ using (var s = OpenSession())
+ using (var tx = s.BeginTransaction())
+ {
+ var galery = new Galery();
+ galery.Images.Add(new Image {Path = "image01.jpg"});
+ s.Persist(galery);
+ Assert.DoesNotThrow(tx.Commit);
+ }
+ using (var s = OpenSession())
+ using (var tx = s.BeginTransaction())
+ {
+ s.CreateQuery("delete from Image").ExecuteUpdate();
+ s.CreateQuery("delete from Galery").ExecuteUpdate();
+ tx.Commit();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-03-07 10:16:09 UTC (rev 4955)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-03-15 16:06:07 UTC (rev 4956)
@@ -429,6 +429,8 @@
<Compile Include="Linq\SelectionTests.cs" />
<Compile Include="Linq\WhereSubqueryTests.cs" />
<Compile Include="Linq\WhereTests.cs" />
+ <Compile Include="ListIndex\SimpleOneToMany.cs" />
+ <Compile Include="ListIndex\SimpleOneToManyTest.cs" />
<Compile Include="MappingTest\NonReflectiveBinderFixture.cs" />
<Compile Include="MappingTest\Wicked.cs" />
<Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Employee.cs" />
@@ -2126,6 +2128,7 @@
<EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" />
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="ListIndex\SimpleOneToMany.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2113\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1981\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2074\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|