-->
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.  [ 7 posts ] 
Author Message
 Post subject: Multithreading routine
PostPosted: Fri Jun 16, 2006 3:25 pm 
Beginner
Beginner

Joined: Fri May 12, 2006 10:48 am
Posts: 33
Hi, I’ve worked in a multithreading routine; this routine access to the data base using NHibernate but it fails.
The massage I find is {"There is already an open DataReader associated with this Command which must be closed first."}

Could anybody help me?


Top
 Profile  
 
 Post subject: Re: Multithreading routine
PostPosted: Fri Jun 16, 2006 3:27 pm 
Newbie

Joined: Fri Jun 16, 2006 11:20 am
Posts: 8
martinvicente wrote:
Hi, I’ve worked in a multithreading routine; this routine access to the data base using NHibernate but it fails.
The massage I find is {"There is already an open DataReader associated with this Command which must be closed first."}

Could anybody help me?


Probably is because you're sharing the ISession across the Threads.
Remember that behind a ISession there is a Connection, and you can execute only one query at once. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 3:45 pm 
Beginner
Beginner

Joined: Fri May 12, 2006 10:48 am
Posts: 33
Hi, thanks for your reply.
I'm just getting a session in each thread, then I execute the query and finally I close the session. the error that i'm getting now is "Creating a proxy instance failed"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 4:02 pm 
Newbie

Joined: Fri Jun 16, 2006 11:20 am
Posts: 8
martinvicente wrote:
Hi, thanks for your reply.
I'm just getting a session in each thread, then I execute the query and finally I close the session. the error that i'm getting now is "Creating a proxy instance failed"


That happened to me when I'm trying to load an Entity which is defined as "lazy" and it isn't defined as virtual properties and not sealed.

Also you need to define the "proxy" attribute in the entity ".hbm.xml" pointing to the class itself.

See this chapter:
http://www.hibernate.org/hib_docs/nhibe ... ce-proxies

Hope it works!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 5:01 pm 
Beginner
Beginner

Joined: Fri May 12, 2006 10:48 am
Posts: 33
I've defined the "proxy" attribute in the entities ".hbm.xml" pointing to the class itself, but I continue getting the same error message.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 8:10 pm 
Newbie

Joined: Fri Jun 16, 2006 11:20 am
Posts: 8
martinvicente wrote:
I've defined the "proxy" attribute in the entities ".hbm.xml" pointing to the class itself, but I continue getting the same error message.


Are all the properties, methods & delegates declared as "virtual"?
Is the class defined as sealed? If so, "un-seal" it...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 20, 2006 9:37 am 
Beginner
Beginner

Joined: Fri May 12, 2006 10:48 am
Posts: 33
All the properties, methods & delegates are declared as "virtual" and
the class isn't defined as sealed


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

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.