I ran into a strange issue with NHibernate today. I am pretty sure that there's an explanation and solution for this. So here we go: I have isolated one query with the issue and the code looks as follows:
_session = _sessionFactory.OpenSession();
ITransaction _transaction = _session.BeginTransaction();
var result = _session.QueryOver<Employee>()
.Where(x => x.uid == employeeuid)
.SingleOrDefault();
_transaction.Commit();
The Employee object has some references etc., but I don't think this is important right now. UID is a string. What basically happens is that log4net tells me that the same query is executed three times:
SELECT <some columns...> FROM employer this_ WHERE this_.uid = <uid-string>
As you can see... a plain query. Can anyone give me a hint how to get rid of the query-overhead?
Regards, Martin
I would first back this up by seeing what is being queried on the database itself. To find out what the database is actualy doing either:-
Personally I am a little suspicious of the amount of log info that log4Net spews out.