Skip to content

Commit 580fbcd

Browse files
Merge branch 'master' into NoImplicitJoin
2 parents 4acb76e + d299c91 commit 580fbcd

File tree

142 files changed

+3774
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+3774
-458
lines changed

.deepsource.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version = 1
2+
3+
test_patterns = ["src/NHibernate.Test/**"]
4+
5+
[[analyzers]]
6+
name = "csharp"
7+
enabled = true

doc/reference/modules/configuration.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,26 @@ var session = sessions.OpenSession(conn);
610610
</para>
611611
</entry>
612612
</row>
613+
<row>
614+
<entry>
615+
<literal>cache.read_write_lock_factory</literal>
616+
</entry>
617+
<entry>
618+
Specify the cache lock factory to use for read-write cache regions.
619+
Defaults to the built-in <literal>async</literal> cache lock factory.
620+
<para>
621+
<emphasis role="strong">eg.</emphasis>
622+
<literal>async</literal>, or <literal>sync</literal>, or <literal>classname.of.CacheLockFactory, assembly</literal> with custom implementation of <literal>ICacheReadWriteLockFactory</literal>
623+
</para>
624+
<para>
625+
<literal>async</literal> uses a single writer multiple readers locking mechanism supporting asynchronous operations.
626+
</para>
627+
<para>
628+
<literal>sync</literal> uses a single access locking mechanism which will throw on asynchronous
629+
operations but may have better performances than the <literal>async</literal> provider for applications using the .Net Framework (4.8 and below).
630+
</para>
631+
</entry>
632+
</row>
613633
<row>
614634
<entry>
615635
<literal>cache.region_prefix</literal>
@@ -702,6 +722,24 @@ var session = sessions.OpenSession(conn);
702722
</para>
703723
</entry>
704724
</row>
725+
<row>
726+
<entry>
727+
<literal>query.throw_never_cached</literal>
728+
</entry>
729+
<entry>
730+
Should queries set as cacheable raise an error if they reference an entity using the cache
731+
<xref linkend="performance-cache-never" /> (the default is enabled).
732+
<para>
733+
<emphasis role="strong">eg.</emphasis>
734+
<literal>true</literal> | <literal>false</literal>
735+
</para>
736+
<para>
737+
Disabling this setting causes NHibernate to ignore the caching of such queries without
738+
raising an error. Furthermore NHibernate will log a warning on cacheable queries
739+
referencing an entity using the <literal>never</literal> cache strategy.
740+
</para>
741+
</entry>
742+
</row>
705743
<row>
706744
<entry>
707745
<literal>query.factory_class</literal>
@@ -1195,6 +1233,58 @@ var session = sessions.OpenSession(conn);
11951233
</para>
11961234
</entry>
11971235
</row>
1236+
<row>
1237+
<entry>
1238+
<literal>oracle.use_binary_floating_point_types</literal>
1239+
</entry>
1240+
<entry>
1241+
<para>
1242+
Set whether NHibernate should map .Net <literal>double</literal> and <literal>float</literal>
1243+
to Oracle <literal>BINARY_DOUBLE</literal> and <literal>BINARY_FLOAT</literal> types or use
1244+
Oracle <literal>DOUBLE</literal> and <literal>FLOAT</literal> types.
1245+
</para>
1246+
<para>
1247+
Oracle 10g introduced <literal>BINARY_DOUBLE</literal> and <literal>BINARY_FLOAT</literal>
1248+
types which are compatible with .NET <literal>double</literal> and <literal>float</literal>
1249+
types, while Oracle <literal>DOUBLE</literal> and <literal>FLOAT</literal> are not. Oracle
1250+
<literal>DOUBLE</literal> and <literal>FLOAT</literal> types do not conform to the IEEE
1251+
standard as they are internally implemented as <literal>NUMBER</literal> type, which
1252+
makes them an exact numeric type.
1253+
</para>
1254+
<para>
1255+
<emphasis role="strong">eg.</emphasis>
1256+
<literal>true</literal> for using Oracle <literal>BINARY_DOUBLE</literal> and
1257+
<literal>BINARY_FLOAT</literal> types | <literal>false</literal> for using Oracle
1258+
<literal>DOUBLE</literal> and <literal>FLOAT</literal> types.
1259+
</para>
1260+
<para>
1261+
<literal>false</literal> by default. See
1262+
<ulink url="https://docs.oracle.com/database/121/TTSQL/types.htm#TTSQL126">ANSI SQL data types</ulink>.
1263+
</para>
1264+
</entry>
1265+
</row>
1266+
<row>
1267+
<entry>
1268+
<literal>oracle.suppress_decimal_invalid_cast_exception</literal>
1269+
</entry>
1270+
<entry>
1271+
<para>
1272+
This setting specifies whether to suppress or not the <literal>InvalidCastException</literal>
1273+
and return a rounded-off 28 precision value if the Oracle <literal>NUMBER</literal> value
1274+
has more than a 28 precision.
1275+
</para>
1276+
<para>
1277+
<emphasis role="strong">eg.</emphasis>
1278+
<literal>true</literal> for suppressing the exception | <literal>false</literal> for letting
1279+
the exception be raised.
1280+
</para>
1281+
<para>
1282+
<literal>false</literal> by default. See
1283+
<ulink url="https://docs.oracle.com/en/database/oracle/oracle-data-access-components/19.3/odpnt/DataReaderSuppressGetDecimalInvalidCastException.html">SuppressGetDecimalInvalidCastException</ulink>.
1284+
This setting works only with ODP.NET 19.10 or newer.
1285+
</para>
1286+
</entry>
1287+
</row>
11981288
<row>
11991289
<entry>
12001290
<literal>odbc.explicit_datetime_scale</literal>

doc/reference/modules/performance.xml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,17 +733,18 @@ using(var iter = session
733733
<area id="cache1" coords="2 70"/>
734734
<area id="cache2" coords="3 70"/>
735735
</areaspec>
736-
<programlisting><![CDATA[<cache
737-
usage="read-write|nonstrict-read-write|read-only"
736+
<programlisting><![CDATA[<cache
737+
usage="read-write|nonstrict-read-write|read-only|never"
738738
region="RegionName"
739739
/>]]></programlisting>
740740
<calloutlist>
741741
<callout arearefs="cache1">
742742
<para>
743743
<literal>usage</literal> specifies the caching strategy:
744744
<literal>read-write</literal>,
745-
<literal>nonstrict-read-write</literal> or
746-
<literal>read-only</literal>
745+
<literal>nonstrict-read-write</literal>,
746+
<literal>read-only</literal> or
747+
<literal>never</literal>
747748
</para>
748749
</callout>
749750
<callout arearefs="cache2">
@@ -824,6 +825,26 @@ using(var iter = session
824825

825826
</sect2>
826827

828+
<sect2 id="performance-cache-never">
829+
<title>Strategy: never</title>
830+
831+
<para>
832+
By default, without a cache configuration, entities are not cacheable. But they may still be referenced
833+
in cacheable queries, which results will then be cached according to the values these non cacheable
834+
entities have. So, their data may be indirectly cached through cacheable queries.
835+
</para>
836+
837+
<para>
838+
By using the cache strategy <literal>never</literal>, such indirect caching of these entities data will
839+
be forbidden by NHibernate. Setting as cacheable a query referencing entities with strategy
840+
<literal>never</literal> will be treated as an error by default. Alternatively, the
841+
<literal>query.throw_never_cached</literal> <link linkend="configuration-optional">setting</link> can be
842+
set to <literal>false</literal>: instead of raising an error, it will disable the query cache on such
843+
queries, and log a warning.
844+
</para>
845+
846+
</sect2>
847+
827848
<para>
828849
The following table shows which providers are compatible with which concurrency strategies.
829850
</para>

releasenotes.txt

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,53 @@
1-
Build 5.3.10
1+
Build 5.3.12
2+
=============================
3+
4+
Release notes - NHibernate - Version 5.3.12
5+
6+
5 issues were resolved in this release.
7+
8+
** Bug
9+
10+
* #3046 Regression for filters on entity joins with many-to-one disabled
11+
* #3029 InvalidOperationException on proxies with explicit implementation of a generic method
12+
13+
** Improvement
14+
15+
* #3043 Improve exception for query on delayed id
16+
17+
** Test
18+
19+
* #3035 Support tests in VS 2022
20+
21+
** Task
22+
23+
* #3044 Release 5.3.12
24+
25+
Build 5.3.11
26+
=============================
27+
28+
Release notes - NHibernate - Version 5.3.11
29+
30+
12 issues were resolved in this release.
31+
32+
** Bug
33+
34+
* #3005 LINQ: Casting from object to TimeSpan throws
35+
* #2988 Query issues when using not-found='ignore' in entity mapping
36+
* #2965 Fix possible issue with logging for Linq Readonly tests
37+
* #2963 Time is incompatible with bigint for TimeAsTimeSpanType
38+
* #2937 NRE in linq processing of custom components
39+
* #2928 Session.Refresh when entity is IFieldInterceptorAccessor throws a MappingException
40+
* #2904 SQL query result not retrieved from second level cache
41+
* #2876 Schema validation not working with NpgSql v5
42+
* #2862 NHibernate AsyncReaderWriterLock stalls under load
43+
* #2727 The session.Load(obj, id) overload can't handle proxies
44+
45+
** Task
46+
47+
* #3019 Release 5.3.11
48+
* #2984 Bump AsyncGenerator to 0.18.3 for 5.3 branch with fix for .net 6
49+
50+
Build 5.3.10
251
=============================
352

453
Release notes - NHibernate - Version 5.3.10

src/AsyncGenerator.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@
226226
- conversion: Ignore
227227
anyBaseTypeRule: IsTestCase
228228
executionPhase: PostProviders
229+
- conversion: Ignore
230+
name: SyncOnlyCacheFixture
229231
ignoreDocuments:
230232
- filePathEndsWith: Linq/MathTests.cs
231233
- filePathEndsWith: Linq/ExpressionSessionLeakTest.cs

src/NHibernate.Example.Web/NHibernate.Example.Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</ItemGroup>
2222

2323
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
24-
<PackageReference Include="System.Data.SqlClient" Version="4.4.2" />
24+
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

src/NHibernate.Test.VisualBasic/Program.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Public Class Program
44
Return New NUnitLite.AutoRun(GetType(Program).Assembly).Execute(args)
55
End Function
66
End Class
7-
#End If
7+
#End If

src/NHibernate.Test/App.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<property name="cache.use_query_cache">true</property>
3939

4040
<property name="query.startup_check">false</property>
41+
<property name="query.throw_never_cached">true</property>
4142
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
4243

4344
<property name="adonet.batch_size">10</property>

src/NHibernate.Test/Async/CacheTest/CacheFixture.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ namespace NHibernate.Test.CacheTest
1919
{
2020
using System.Threading.Tasks;
2121
[TestFixture]
22-
public class CacheFixtureAsync
22+
public class CacheFixtureAsync: TestCase
2323
{
2424
[Test]
2525
public async Task TestSimpleCacheAsync()
2626
{
2727
await (DoTestCacheAsync(new HashtableCacheProvider()));
2828
}
2929

30-
private CacheKey CreateCacheKey(string text)
30+
protected CacheKey CreateCacheKey(string text)
3131
{
3232
return new CacheKey(text, NHibernateUtil.String, "Foo", null, null);
3333
}
3434

3535
public async Task DoTestCacheAsync(ICacheProvider cacheProvider, CancellationToken cancellationToken = default(CancellationToken))
3636
{
37-
var cache = cacheProvider.BuildCache(typeof(String).FullName, new Dictionary<string, string>());
37+
var cache = (CacheBase) cacheProvider.BuildCache(typeof(String).FullName, new Dictionary<string, string>());
3838

3939
long longBefore = Timestamper.Next();
4040

@@ -44,8 +44,7 @@ private CacheKey CreateCacheKey(string text)
4444

4545
await (Task.Delay(15, cancellationToken));
4646

47-
ICacheConcurrencyStrategy ccs = new ReadWriteCache();
48-
ccs.Cache = cache;
47+
ICacheConcurrencyStrategy ccs = CreateCache(cache);
4948

5049
// cache something
5150
CacheKey fooKey = CreateCacheKey("foo");
@@ -155,12 +154,17 @@ private CacheKey CreateCacheKey(string text)
155154
public async Task MinValueTimestampAsync()
156155
{
157156
var cache = new HashtableCacheProvider().BuildCache("region", new Dictionary<string, string>());
158-
ICacheConcurrencyStrategy strategy = new ReadWriteCache();
159-
strategy.Cache = cache;
160157

161-
await (DoTestMinValueTimestampOnStrategyAsync(cache, new ReadWriteCache()));
162-
await (DoTestMinValueTimestampOnStrategyAsync(cache, new NonstrictReadWriteCache()));
163-
await (DoTestMinValueTimestampOnStrategyAsync(cache, new ReadOnlyCache()));
158+
await (DoTestMinValueTimestampOnStrategyAsync(cache, CreateCache(cache)));
159+
await (DoTestMinValueTimestampOnStrategyAsync(cache, CreateCache(cache, CacheFactory.NonstrictReadWrite)));
160+
await (DoTestMinValueTimestampOnStrategyAsync(cache, CreateCache(cache, CacheFactory.ReadOnly)));
164161
}
162+
163+
protected virtual ICacheConcurrencyStrategy CreateCache(CacheBase cache, string strategy = CacheFactory.ReadWrite)
164+
{
165+
return CacheFactory.CreateCache(strategy, cache, Sfi.Settings);
166+
}
167+
168+
protected override string[] Mappings => Array.Empty<string>();
165169
}
166170
}

0 commit comments

Comments
 (0)