-->
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.  [ 2 posts ] 
Author Message
 Post subject: Concurrency Issue --> Urgent Help Required
PostPosted: Sat May 19, 2007 12:20 am 
Beginner
Beginner

Joined: Wed Aug 30, 2006 2:06 am
Posts: 24
We are using NHibernate Version 1.2.0 and we have an issue related to concurrency. The scenario is as follows.

Our application is web application and we open the Nhibernate session at the business logic layer and perform insert or update of the entity there.

User A and User B opens a particular webpage and updates a particular entity at the same time which results in invalid state.

Is there an out of box option in NHibernate to avoid concurrency issue?

Thanks


Top
 Profile  
 
 Post subject: Re: Concurrency Issue --> Urgent Help Required
PostPosted: Sat May 19, 2007 9:44 am 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
vijayjanakiram wrote:
We are using NHibernate Version 1.2.0 and we have an issue related to concurrency. The scenario is as follows.

Our application is web application and we open the Nhibernate session at the business logic layer and perform insert or update of the entity there.

User A and User B opens a particular webpage and updates a particular entity at the same time which results in invalid state.

Is there an out of box option in NHibernate to avoid concurrency issue?

Thanks


See the NHibernate documentation:
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#transactions

If this is considered an unlikely occurrence I would recommend using a version property on your object. Then it will only update your object if it has not been updated since this user loaded the object.

Now this may not be exactly what you are looking for if you just reload the object from the database just before saving. If the concurrency issue lives outside of the load/save cycle, then it really is more of an application issue, than an OR/M issue. All applications need to be written to take concurrency into account.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.