Skip to content

Commit 5721fd0

Browse files
committed
Clear connection pool for Oracle in test cleanup logic
1 parent bdb559e commit 5721fd0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/NHibernate.Test/TestCase.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
using NUnit.Framework;
1414
using NUnit.Framework.Interfaces;
1515
using System.Text;
16+
using NHibernate.Dialect;
1617
using NHibernate.Driver;
18+
using Oracle.ManagedDataAccess.Client;
1719

1820
namespace NHibernate.Test
1921
{
@@ -313,6 +315,15 @@ protected virtual DebugSessionFactory BuildSessionFactory()
313315
private void Cleanup()
314316
{
315317
Sfi?.Close();
318+
319+
// Clear connection pool for Oracle to avoid problem that was manifested with https://github.com/nhibernate/nhibernate-core/pull/1517:
320+
// As it seems Oracle can cache returned types for query for given connection.
321+
// So exception can be thrown if two tests execute same query but expect different types in result (like for Entity.Id int and Entity.Id Guid)
322+
if (Dialect is Oracle8iDialect)
323+
{
324+
OracleConnection.ClearAllPools();
325+
}
326+
316327
_sessionFactory = null;
317328
cfg = null;
318329
}

0 commit comments

Comments
 (0)