I have two IDbCommand objects that are created from an NHibernate
session, and they are enlisted in a transaction via the NHibernate
session. The first database command inserts a value into an Oracle
global temporary table and the second command reads values from the
table. With an Oracle GTT, a transaction is needed for both commands
in order to preserve the data in the GTT.

The strange thing is that the second command reads values from the
GTT, as expected, when it's run on one server, but the exact same code
doesn't work on the other server. What's even stranger, is that the
first request on the non-working server works if it happens
immediately after the IIS worker processes have been recycled. Each
request after that does not work - specifically, the values in the GTT
are not maintained after being inserted.

ISession session = sessionFactory.GetSession();
ITransaction transaction = session.BeginTransaction();

IDbCommand cmdInsert = session.Connection.CreateCommand();
transaction.Enlist(cmdInsert);
cmdInsert.CommandText = "insert into TEMP_TABLE values (1)";
cmdInsert.ExecuteNonQuery();

IDbCommand cmdRead = session.Connection.CreateCommand();
transaction.Enlist(cmdRead);
cmdRead.CommandText = "select from TEMP_TABLE";

// Nothing is returned here after the second request
cmdRead.ExecuteQuery();

transaction.Commit();

Why would the transaction that is created from an NHibernate session
not properly enlist IDbCommands after the first request to an IIS
server?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to