Skip to content

Commit 49e652d

Browse files
committed
Update TableGenerator.cs
1 parent 0fde63c commit 49e652d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/NHibernate/Id/TableGenerator.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,11 @@ public override object DoWorkInCurrentTransaction(ISessionImplementor session, I
220220
//select + uspdate even for no transaction
221221
//or read committed isolation level (needed for .net?)
222222

223-
IDbCommand qps = conn.CreateCommand();
224-
IDataReader rs = null;
225-
qps.CommandText = query;
226-
qps.CommandType = CommandType.Text;
227-
qps.Transaction = transaction;
223+
IDbCommand qps = session.Factory.ConnectionProvider.Driver.GenerateCommand(CommandType.Text, new SqlString(query), new SqlType[0]);
224+
qps.Connection = conn;
225+
qps.Transaction = transaction;
228226
PersistentIdGeneratorParmsNames.SqlStatementLogger.LogCommand("Reading high value:", qps, FormatStyle.Basic);
227+
IDataReader rs = null;
229228
try
230229
{
231230
rs = qps.ExecuteReader();
@@ -288,4 +287,4 @@ public override object DoWorkInCurrentTransaction(ISessionImplementor session, I
288287
return result;
289288
}
290289
}
291-
}
290+
}

0 commit comments

Comments
 (0)