Skip to content

Commit d229631

Browse files
committed
Merge tag '4.0.3.GA'
2 parents 206d415 + 5c739ad commit d229631

24 files changed

+1111
-511
lines changed

build-common/common.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
effectively SP0).
6161
-->
6262

63-
<property name="project.version" value="4.0.2.GA" overwrite="false" />
63+
<property name="project.version" value="4.0.3.GA" overwrite="false" />
6464

6565
<!-- This version number should be changed if, but only if, there are incompatible
6666
changes compared to the previous version. -->

lib/teamcity/firebird/NHibernate.Test.last-results.xml

Lines changed: 50 additions & 21 deletions
Large diffs are not rendered by default.

lib/teamcity/mysql/NHibernate.Test.last-results.xml

Lines changed: 44 additions & 19 deletions
Large diffs are not rendered by default.

lib/teamcity/oracle/NHibernate.Test.last-results.xml

Lines changed: 60 additions & 31 deletions
Large diffs are not rendered by default.

lib/teamcity/sqlServerCe/NHibernate.Test.last-results.xml

Lines changed: 265 additions & 236 deletions
Large diffs are not rendered by default.

lib/teamcity/sqlServerOdbc/NHibernate.Test.last-results.xml

Lines changed: 137 additions & 107 deletions
Large diffs are not rendered by default.

releasenotes.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Build 4.0.3.GA
2+
=============================
3+
4+
5+
** Bug
6+
* [NH-2504] - Can't use Cacheable with Group By
7+
* [NH-3457] - TemplatedViolatedConstraintNameExtracter.ExtractUsingTemplate calls Substring with wrong arguments
8+
* [NH-3468] - InvalidCastException when deleting entities containing uninitialized lazy components
9+
* [NH-3573] - Query cache statistics not updated when using MultiCriteria
10+
* [NH-3731] - Unable to serialize session after modifying the index of entities in a list
11+
112

213
Build 4.0.2.GA
314
=============================
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace NHibernate.Test.LazyComponentTest
7+
{
8+
public class Address
9+
{
10+
public virtual string Country { get; set; }
11+
public virtual string City { get; set; }
12+
}
13+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
using System.Collections;
2+
using NUnit.Framework;
3+
4+
namespace NHibernate.Test.LazyComponentTest
5+
{
6+
[TestFixture]
7+
public class LazyComponentTestFixture : TestCase
8+
{
9+
protected override IList Mappings
10+
{
11+
get { return new[] {"LazyComponentTest.Person.hbm.xml"}; }
12+
}
13+
14+
protected override string MappingsAssembly
15+
{
16+
get { return "NHibernate.Test"; }
17+
}
18+
19+
protected override void OnSetUp()
20+
{
21+
using (var s = OpenSession())
22+
using (var t = s.BeginTransaction())
23+
{
24+
var person = new Person
25+
{
26+
Name = "Gabor",
27+
Address = new Address
28+
{
29+
Country = "HUN",
30+
City = "Budapest"
31+
}
32+
};
33+
s.Persist(person);
34+
t.Commit();
35+
}
36+
}
37+
38+
protected override void OnTearDown()
39+
{
40+
using (var s = OpenSession())
41+
using (var t = s.BeginTransaction())
42+
{
43+
s.CreateQuery("delete from Person").ExecuteUpdate();
44+
t.Commit();
45+
}
46+
}
47+
48+
[Test]
49+
public void LazyLoadTest()
50+
{
51+
using (var s = OpenSession())
52+
using (var t = s.BeginTransaction())
53+
{
54+
var p = s.CreateQuery("from Person p where name='Gabor'").UniqueResult<Person>();
55+
// make sure component has not been initialized yet
56+
Assert.That(NHibernateUtil.IsPropertyInitialized(p, "Address"), Is.False);
57+
58+
t.Commit();
59+
}
60+
}
61+
62+
[Test]
63+
public void LazyDeleteTest()
64+
{
65+
using (var s = OpenSession())
66+
using (var t = s.BeginTransaction())
67+
{
68+
var p = s.CreateQuery("from Person p where name='Gabor'").UniqueResult<Person>();
69+
// make sure component has not been initialized yet
70+
Assert.That(NHibernateUtil.IsPropertyInitialized(p, "Address"), Is.False);
71+
s.Delete(p);
72+
t.Commit();
73+
}
74+
}
75+
76+
[Test]
77+
public void LazyUpdateTest()
78+
{
79+
using (var s = OpenSession())
80+
using (var t = s.BeginTransaction())
81+
{
82+
var p = s.CreateQuery("from Person p where name='Gabor'").UniqueResult<Person>();
83+
// make sure component has not been initialized yet
84+
Assert.That(!NHibernateUtil.IsPropertyInitialized(p, "Address"));
85+
86+
p.Address.City = "Baja";
87+
s.Update(p);
88+
89+
t.Commit();
90+
}
91+
using (var s = OpenSession())
92+
using (var t = s.BeginTransaction())
93+
{
94+
var p = s.CreateQuery("from Person p where name='Gabor'").UniqueResult<Person>();
95+
Assert.That(p.Address.City, Is.EqualTo("Baja"));
96+
97+
t.Commit();
98+
}
99+
}
100+
}
101+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace NHibernate.Test.LazyComponentTest
7+
{
8+
public class Person
9+
{
10+
public virtual string Name { get; set; }
11+
public virtual Address Address { get; set; }
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
3+
assembly="NHibernate.Test"
4+
namespace="NHibernate.Test.LazyComponentTest">
5+
6+
<class name="Person">
7+
<id name="Name"/>
8+
<component name="Address" lazy="true">
9+
<property name="Country" />
10+
<property name="City" />
11+
</component>
12+
</class>
13+
14+
</hibernate-mapping>

src/NHibernate.Test/Linq/QueryCacheableTests.cs

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,65 @@ public void CacheableRegionBeforeOtherClauses()
114114
Assert.That(Sfi.Statistics.QueryCachePutCount, Is.EqualTo(2));
115115
Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1));
116116
}
117-
}
117+
118+
[Test]
119+
public void GroupByQueryIsCacheable()
120+
{
121+
Sfi.Statistics.Clear();
122+
Sfi.QueryCache.Clear();
123+
124+
var c = db
125+
.Customers
126+
.GroupBy(x => x.Address.Country)
127+
.Select(x=>x.Key)
128+
.Cacheable()
129+
.ToList();
130+
131+
c = db
132+
.Customers
133+
.GroupBy(x => x.Address.Country)
134+
.Select(x => x.Key)
135+
.ToList();
136+
137+
c = db
138+
.Customers
139+
.GroupBy(x => x.Address.Country)
140+
.Select(x => x.Key)
141+
.Cacheable()
142+
.ToList();
143+
144+
Assert.That(Sfi.Statistics.QueryExecutionCount, Is.EqualTo(2));
145+
Assert.That(Sfi.Statistics.QueryCachePutCount, Is.EqualTo(1));
146+
Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1));
147+
}
148+
149+
[Test]
150+
public void GroupByQueryIsCacheable2()
151+
{
152+
Sfi.Statistics.Clear();
153+
Sfi.QueryCache.Clear();
154+
155+
var c = db
156+
.Customers.Cacheable()
157+
.GroupBy(x => x.Address.Country)
158+
.Select(x => x.Key)
159+
.ToList();
160+
161+
c = db
162+
.Customers
163+
.GroupBy(x => x.Address.Country)
164+
.Select(x => x.Key)
165+
.ToList();
166+
167+
c = db
168+
.Customers.Cacheable()
169+
.GroupBy(x => x.Address.Country)
170+
.Select(x => x.Key)
171+
.ToList();
172+
173+
Assert.That(Sfi.Statistics.QueryExecutionCount, Is.EqualTo(2));
174+
Assert.That(Sfi.Statistics.QueryCachePutCount, Is.EqualTo(1));
175+
Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1));
176+
}
177+
}
118178
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace NHibernate.Test.NHSpecificTest.NH3731
5+
{
6+
[Serializable]
7+
class Parent
8+
{
9+
public Parent()
10+
{
11+
ChildrenList = new List<ListChild>();
12+
ChildrenMap = new Dictionary<string, MapChild>();
13+
}
14+
15+
public virtual Guid Id { get; set; }
16+
public virtual string Name { get; set; }
17+
public virtual IList<ListChild> ChildrenList { get; set; }
18+
public virtual IDictionary<string, MapChild> ChildrenMap { get; set; }
19+
}
20+
21+
[Serializable]
22+
class ListChild
23+
{
24+
public virtual Guid Id { get; set; }
25+
public virtual string Name { get; set; }
26+
}
27+
28+
[Serializable]
29+
class MapChild
30+
{
31+
public virtual Guid Id { get; set; }
32+
public virtual string Name { get; set; }
33+
}
34+
}

0 commit comments

Comments
 (0)