Description
NHibernate Version: 5.4.2
.net framework 4.8
We observed that running ExecuteUpdate on a HQL-Query causes updates that have been done before to be committed afterwards.
session.BeginTransaction();
session.Merge(someEntity);
session.Flush();
session.CreateQuery("Update MultiTableEntity set property = value where id = 123").ExecuteUpdate();
Debugging into NHibernate I was able to track this down to ShouldIsolateTemporaryTableDDL
at least it seems like it.
For some reason NHibernate tries to create a (temporary) table which apparently fails because it already exists but just logs the error as debug and continues.
Since creating tables in oracle is causing a commit this seems to be the issue.
I noticed that there is a function ShouldIsolateTemporaryTableDDL
in the class AbstractStatementExecutor
which apparently first checks the dialect for PerformTemporaryTableDDLInIsolation
which returns false or rather null when using the oracle dialect which if I am understanding this correctly should return true because oracle has an implicit commit when doing DDL operations and therefore DDL should run in isolation.
protected virtual bool ShouldIsolateTemporaryTableDDL()
{
bool? dialectVote = Factory.Dialect.PerformTemporaryTableDDLInIsolation();
if (dialectVote.HasValue)
{
return dialectVote.Value;
}
return Factory.Settings.IsDataDefinitionImplicitCommit;
}