Skip to content

Commit 449beeb

Browse files
committed
Allow type element
1 parent e75bff0 commit 449beeb

File tree

6 files changed

+128
-117
lines changed

6 files changed

+128
-117
lines changed

src/NHibernate.Test/CollectionTest/IdBagFixture.hbm.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
</id>
77
<property name="Name" column="aname" />
88
<idbag name="Items" cascade="all-delete-orphan">
9-
<collection-id type="Int32" column="item_id">
9+
<collection-id>
10+
<column name="item_id" />
1011
<generator class="increment" />
12+
<type name="Int64" />
1113
</collection-id>
1214
<key column="a_id" />
1315
<element type="string" />

src/NHibernate.Test/MappingByCode/MappersTests/CollectionIdMapperTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public void WhenCreateThenHasDefaultTypeAndGenerator()
1717
var hbmId = new HbmCollectionId();
1818
new CollectionIdMapper(hbmId);
1919
Assert.That(hbmId.generator.@class, Is.Not.Null.And.Not.Empty);
20-
Assert.That(hbmId.type, Is.Not.Null.And.Not.Empty);
20+
Assert.That(hbmId.type1, Is.Not.Null.And.Not.Empty);
21+
Assert.That(hbmId.type, Is.Null);
2122
}
2223

2324
[Test]
@@ -27,19 +28,21 @@ public void WhenSetGeneratorThenChangeType()
2728
new CollectionIdMapper(hbmId).Generator(Generators.HighLow);
2829

2930
Assert.That(hbmId.generator.@class, Is.EqualTo("hilo"));
30-
Assert.That(hbmId.type.ToLowerInvariant(), Does.Contain("int"));
31+
Assert.That(hbmId.type1.ToLowerInvariant(), Does.Contain("int"));
32+
Assert.That(hbmId.type, Is.Null);
3133
}
3234

3335
[Test]
3436
public void WhenForceTypeThenNotChangeType()
3537
{
3638
var hbmId = new HbmCollectionId();
3739
var collectionIdMapper = new CollectionIdMapper(hbmId);
38-
collectionIdMapper.Type((IIdentifierType) NHibernateUtil.Int64);
40+
collectionIdMapper.Type(NHibernateUtil.Int64);
3941
collectionIdMapper.Generator(Generators.HighLow);
4042

4143
Assert.That(hbmId.generator.@class, Is.EqualTo("hilo"));
42-
Assert.That(hbmId.type, Is.EqualTo("Int64"));
44+
Assert.That(hbmId.type1, Is.EqualTo("Int64"));
45+
Assert.That(hbmId.type, Is.Null);
4346
}
4447

4548
[Test]

0 commit comments

Comments
 (0)