@@ -295,22 +295,6 @@ public static void DropSchema(bool useStdOut, SchemaExport export, ISessionFacto
295
295
{
296
296
switch ( sfi ? . ConnectionProvider . Driver )
297
297
{
298
- // Clear connection pool for Oracle to avoid problem that was manifested with https://github.com/nhibernate/nhibernate-core/pull/1517:
299
- // As it seems Oracle can cache returned types for query for given connection.
300
- // So exception can be thrown if two tests execute same query but with different types in result (like for Entity.Id int and Entity.Id Guid)
301
- case OracleClientDriver oraSysData :
302
- case OracleDataClientDriver oraUnmanaged :
303
- case OracleManagedDataClientDriver oraManaged :
304
- using ( var con = sfi . ConnectionProvider . GetConnection ( ) )
305
- using ( var cmd = con . CreateCommand ( ) )
306
- {
307
- cmd . CommandText = "alter system flush shared_pool;" ;
308
- cmd . Connection = con ;
309
- cmd . ExecuteNonQuery ( ) ;
310
- }
311
-
312
- break ;
313
-
314
298
// Firebird will pool each connection created during the test and will marked as used any table
315
299
// referenced by queries. It will at best delays those tables drop until connections are actually
316
300
// closed, or immediately fail dropping them.
@@ -332,6 +316,25 @@ protected virtual DebugSessionFactory BuildSessionFactory()
332
316
333
317
private void Cleanup ( )
334
318
{
319
+ switch ( Sfi ? . ConnectionProvider . Driver )
320
+ {
321
+ // Clear connection pool for Oracle to avoid problem that was manifested with https://github.com/nhibernate/nhibernate-core/pull/1517:
322
+ // As it seems Oracle can cache returned types for query for given connection.
323
+ // So exception can be thrown if two tests execute same query but with different types in result (like for Entity.Id int and Entity.Id Guid)
324
+ case OracleClientDriver oraSysData :
325
+ case OracleDataClientDriver oraUnmanaged :
326
+ case OracleManagedDataClientDriver oraManaged :
327
+ using ( var con = Sfi . ConnectionProvider . GetConnection ( ) )
328
+ using ( var cmd = con . CreateCommand ( ) )
329
+ {
330
+ cmd . CommandText = @"BEGIN DBMS_RESULT_CACHE.FLUSH; END;" ;
331
+ cmd . Connection = con ;
332
+ cmd . ExecuteNonQuery ( ) ;
333
+ }
334
+
335
+ break ;
336
+ }
337
+
335
338
Sfi ? . Close ( ) ;
336
339
_sessionFactory = null ;
337
340
cfg = null ;
0 commit comments