Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ed7a6d8
Fix support for null datetime parameters for Npgsql 6+ (#3299)
hazzik May 8, 2023
43c5fce
Fix building proxies for classess with static interface members (#3298)
hazzik May 9, 2023
b55afb3
Npgsql 6: set parameter DbType to DateTime2 when value is not Utc Dat…
hazzik May 9, 2023
169b0d4
Backport handling of null DateTime parameters in Npgsql 6+ (#3300)
fredericDelaporte May 11, 2023
170210a
Upgrade NUnit3TestAdapter to fix "Unknown framework version 7.0" (#3302)
fredericDelaporte May 15, 2023
c49a2a9
Fix SetSnapShot CopyTo variance failure (#3304)
fredericDelaporte May 19, 2023
19d4549
Move persist tracking context out of the loop in AbstractFlushingEven…
hazzik Jun 6, 2023
c030026
Fix referencing nullable entity in correlated subquery (#3312)
bahusoid Jun 11, 2023
e9eab67
Fix LINQ cross join issue with InformixDialect (#3313)
bahusoid Jun 11, 2023
469b864
Enable dev builds for 5.3.17
fredericDelaporte Jun 11, 2023
c70cdcf
Fix NRE with reused fetch and collection join (#3314)
bahusoid Jun 12, 2023
85600e2
Enable 5.4.3 dev builds
bahusoid Jun 12, 2023
0e08e91
Release 5.3.17 (#3315)
fredericDelaporte Jun 12, 2023
03bca68
Merge 5.3.17 in 5.4.x
fredericDelaporte Jun 12, 2023
86d463a
Fix many-to-many fetch issue (#3316)
bahusoid Jun 14, 2023
8cb65c8
Fix components list lazy loading with not lazy associations (#3321)
bahusoid Jun 17, 2023
e2e6cbe
Fix fetching lazy component on not mapped interface (#3320)
bahusoid Jun 20, 2023
47aaa7e
Fix FetchLazyProperties updates modified properties (#3343)
bahusoid Jun 30, 2023
8067451
Enable dev builds for 5.3.18
bahusoid Jun 30, 2023
9a8ac77
Fix lazy property handling with field accessors (#3345)
bahusoid Jul 1, 2023
218379c
Release 5.3.18 (#3346)
fredericDelaporte Jul 2, 2023
412e529
Merge 5.3.18 into 5.4.x
fredericDelaporte Jul 2, 2023
b8d9abd
Release 5.4.3 (#3349)
fredericDelaporte Jul 4, 2023
a390e6d
Merge 5.4.3 in master
fredericDelaporte Jul 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
],
"packageRules": [
{
"matchPackagePrefixes": [
"NUnit"
],
"matchSourceUrls": ["https://github.com/nunit/nunit"],
"groupName": "NUnit"
},
{
Expand Down
63 changes: 62 additions & 1 deletion releasenotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
Build 5.4.2
Build 5.4.3
=============================

Release notes - NHibernate - Version 5.4.3

11 issues were resolved in this release.

** Bug

* #3317 Issue with components list lazy loading with not lazy association
* #3307 IsDirty performance hit since 5.4.0
* #3295 C# 8/11 Static interface members support
* #3291 Npgsql 6+ issues with null DateTime parameter types
* #3290 Incorrect fetch of Many-to-Many relation
* #3289 Fetching lazy loaded component causes n + 1 query when querying a subclass abstraction
* #3288 NullReferenceException is thrown when using Fetch

** Task

* #3349 Release 5.4.3
* #3348 Merge 5.3.18 in 5.4.x
* #3318 Merge 5.3.17 in 5.4.x
* #3302 Upgrade NUnit3TestAdapter to fix "Unknown framework version 7.0"


Build 5.4.2
=============================

Release notes - NHibernate - Version 5.4.2
Expand Down Expand Up @@ -234,6 +259,42 @@ Release notes - NHibernate - Version 5.4.0
* #2242 Test case for NH-3972 - SQL error when selecting a column of a subclass when sibling classes have a column of the same name


Build 5.3.18
=============================

Release notes - NHibernate - Version 5.3.18

3 issues were resolved in this release.

** Bug

* #3333 Lazy property with nosetter accessor remains uninitialized
* #3330 Linq with FetchLazyProperties() resets lazy property changes

** Task

* #3346 Release 5.3.18


Build 5.3.17
=============================

Release notes - NHibernate - Version 5.3.17

5 issues were resolved in this release.

** Bug

* #3306 Invalid SQL when referencing nullable entity in correlated subquery
* #3304 Fix SetSnapShot CopyTo variance failure
* #3294 Undefined join type failure with cross joins and Informix

** Task

* #3315 Release 5.3.17
* #3300 Backport handling of null DateTime parameters in Npgsql 6+


Build 5.3.16
=============================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="NUnitLite" Version="3.13.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,45 @@ public async Task TestLinqFetchAllPropertiesAsync()
AssertFetchAllProperties(person);
}

[TestCase(true)]
[TestCase(false)]
public async Task TestLinqFetchAllProperties_WhenLazyPropertyChangedAsync(bool initLazyPropertyFetchGroup)
{
Person person;
using (var s = OpenSession())
{
person = await (s.GetAsync<Person>(1));
if (initLazyPropertyFetchGroup)
CollectionAssert.AreEqual(new byte[] { 0 }, person.Image);

person.Image = new byte[] { 1, 2, 3 };

var allPersons = await (s.Query<Person>().FetchLazyProperties().ToListAsync());
// After execute FetchLazyProperties(), I expected to see that the person.Image would be { 1, 2, 3 }.
// Because I changed this person.Image manually, I didn't want to lose those changes.
// But test failed. Оld value returned { 0 }.
CollectionAssert.AreEqual(new byte[] { 1, 2, 3 }, person.Image);
}
}

[TestCase(true)]
[TestCase(false)]
public async Task TestLinqFetchProperty_WhenLazyPropertyChangedAsync(bool initLazyPropertyFetchGroup)
{
Person person;
using (var s = OpenSession())
{
person = await (s.GetAsync<Person>(1));
if (initLazyPropertyFetchGroup)
CollectionAssert.AreEqual(new byte[] { 0 }, person.Image);

person.Image = new byte[] { 1, 2, 3 };

var allPersons = await (s.Query<Person>().Fetch(x => x.Image).ToListAsync());
CollectionAssert.AreEqual(new byte[] { 1, 2, 3 }, person.Image);
}
}

private static void AssertFetchAllProperties(Person person)
{
Assert.That(person, Is.Not.Null);
Expand Down
56 changes: 55 additions & 1 deletion src/NHibernate.Test/Async/LazyProperty/LazyPropertyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
using System.Linq;
using NHibernate.Cfg;
using NHibernate.Intercept;
using NHibernate.Linq;
using NHibernate.Tuple.Entity;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using NHibernate.Linq;

namespace NHibernate.Test.LazyProperty
{
Expand Down Expand Up @@ -67,6 +67,7 @@ protected override void OnSetUp()
Id = 1,
ALotOfText = "a lot of text ...",
Image = new byte[10],
NoSetterImage = new byte[10],
FieldInterceptor = "Why not that name?"
});
tx.Commit();
Expand Down Expand Up @@ -391,5 +392,58 @@ public async Task CanMergeTransientWithLazyPropertyInCollectionAsync()
Assert.That(book.Words.First().Content, Is.EqualTo(new byte[1] { 0 }));
}
}

[Test(Description = "GH-3333")]
public async Task GetLazyPropertyWithNoSetterAccessor_PropertyShouldBeInitializedAsync()
{
using (ISession s = OpenSession())
{
var book = await (s.GetAsync<Book>(1));
var image = book.NoSetterImage;
// Fails. Property remains uninitialized after it has been accessed.
Assert.That(NHibernateUtil.IsPropertyInitialized(book, "NoSetterImage"), Is.True);
}
}

[Test(Description = "GH-3333")]
public async Task GetLazyPropertyWithNoSetterAccessorTwice_ResultsAreSameObjectAsync()
{
using (ISession s = OpenSession())
{
var book = await (s.GetAsync<Book>(1));
var image = book.NoSetterImage;
var sameImage = book.NoSetterImage;
// Fails. Each call to a property getter returns a new object.
Assert.That(ReferenceEquals(image, sameImage), Is.True);
}
}

[Test]
public async Task CanSetValueForLazyPropertyNoSetterAsync()
{
Book book;
using (ISession s = OpenSession())
{
book = await (s.GetAsync<Book>(1));
book.NoSetterImage = new byte[]{10};
}

Assert.That(NHibernateUtil.IsPropertyInitialized(book, nameof(book.NoSetterImage)), Is.True);
CollectionAssert.AreEqual(book.NoSetterImage, new byte[] { 10 });
}

[Test]
public async Task CanFetchLazyPropertyNoSetterAsync()
{
using (ISession s = OpenSession())
{
var book = await (s
.Query<Book>()
.Fetch(x => x.NoSetterImage)
.FirstAsync(x => x.Id == 1));

Assert.That(NHibernateUtil.IsPropertyInitialized(book, nameof(book.NoSetterImage)), Is.True);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System.Linq;
using NHibernate.Linq;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.GH3288
{
using System.Threading.Tasks;
[TestFixture]
public class FetchAndCollectionJoinFixtureAsync : BugTestCase
{
protected override void OnSetUp()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();
var middleEntity = new MiddleEntity();
middleEntity.Components.Add(new Component { MiddleEntity = middleEntity, Value = 1 });
var te = new TopEntity
{
MiddleEntity = middleEntity
};
session.Save(middleEntity);
session.Save(te);

transaction.Commit();
}

protected override void OnTearDown()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();
session.Delete("from System.Object");

transaction.Commit();
}

[Test]
public async Task ReuseEntityJoinWithCollectionJoinAsync()
{
using var session = OpenSession();

var entities = await (session.Query<TopEntity>()
.Fetch(e => e.MiddleEntity)
.Where(e => e.MiddleEntity.Components.Any(e => e.Value != 0))
.ToListAsync());
Assert.That(entities.Count, Is.EqualTo(1));
}
}
}
111 changes: 111 additions & 0 deletions src/NHibernate.Test/Async/NHSpecificTest/GH3289/FixtureByCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.GH3289
{
using System.Threading.Tasks;
[TestFixture]
public class ByCodeFixtureAsync : TestCaseMappingByCode
{
protected override HbmMapping GetMappings()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(x => x.Id, m => m.Generator(Generators.Identity));
rc.Property(x => x.Name);
rc.Component(x => x.Component);
});
mapper.Class<OtherEntity>(rc =>
{
rc.Id(x => x.Id, m => m.Generator(Generators.Identity));
rc.Property(x => x.Name);
rc.Component(x => x.Component);
});
mapper.JoinedSubclass<SubEntity>(rc =>
{
rc.Key(k => k.Column("Id"));
rc.Property(x => x.SomeProperty);
});
mapper.Component<Component>(rc =>
{
rc.Property(x => x.Field);
rc.Lazy(true);
});

return mapper.CompileMappingForAllExplicitlyAddedEntities();
}

protected override void OnSetUp()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();
var e1 = new SubEntity { Name = "Jim" };
session.Save(e1);

transaction.Commit();
}

protected override void OnTearDown()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();

if (Dialect.SupportsTemporaryTables)
session.CreateQuery("delete from System.Object").ExecuteUpdate();
else
session.Delete("from System.Object");

transaction.Commit();
}

[Test]
public async Task TestSubEntityInterfaceWithFetchIsPropertyInitializedAsync()
{
using var session = OpenSession();
var data = await (session.Query<ISubEntity>()
.Fetch(e => e.Component)
.ToListAsync());
var result = NHibernateUtil.IsPropertyInitialized(data[0], "Component");

Assert.That(result, Is.True);
}

[Test]
public async Task TestEntityInterfaceWithFetchIsPropertyInitializedAsync()
{
using var session = OpenSession();
var data = await (session.Query<IEntity>()
.Fetch(e => e.Component)
.ToListAsync());
var result = NHibernateUtil.IsPropertyInitialized(data[0], "Component");

Assert.That(result, Is.True);
}

[Test]
public async Task TestSubEntityWithFetchIsPropertyInitializedAsync()
{
using var session = OpenSession();
var data = await (session.Query<SubEntity>()
.Fetch(e => e.Component)
.ToListAsync());
var result = NHibernateUtil.IsPropertyInitialized(data[0], "Component");

Assert.That(result, Is.True);
}
}
}
Loading