-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Other connection resultset returned. Gurus advice needed
PostPosted: Wed Mar 11, 2009 4:19 pm 
Beginner
Beginner

Joined: Thu Apr 27, 2006 5:49 am
Posts: 31
Hibernate version:
2.0.1.4000
.NET version
2.0
Database
MS SQL 2005

Hello everyone.

Today I found that at the first sight harmless query might bring a lot of problems. Consider this code, which loads an object id by url using stored procedure:

Code:
string urlNameWithoutWww = urlName;
string urlNameWithWww = CONST_WWWPrefix + urlName;

IQuery query = session.CreateSQLQuery(@"EXEC [dbo].[GetObjectId] @hostname = :name, @hostname2 = :name2");

query.SetString("name", urlNameWithoutWww);
query.SetString("name2", urlNameWithWww);

int id = query.UniqueResult<int>();


Rarely returned result wasn’t an int and the UniqueResult failed. I had changed the last line to the following:

Code:
IList list = query.List();


So, I could parse result by myself and see what is actually here. To my surprise sometimes the resulting list contained not a single value, but a list of values from more than 20 items. And what is more interesting if there was a single int in the resultset (as expected) it’s value could be invalid from the point that it doesn’t corresponds to provided hostnames.

I have a strong feeling that somewhere under the hood NHibernate mess with resultsets and some queries receive results of other queries. I am not sure if it is actually NHibernate problem, or the problem of .NET itself. I strongly believe that the problem is related to the http://forum.hibernate.org/viewtopic.ph ... getordinal post. This happens only if a lot of requests come to web server at the same time.

I am interesting if anyone had faced such a problem? It is of urgent importance to me since it looks like I can’t trust NHibernate anymore. Every single query result must be checked to make sure it belongs to that query.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.