Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:53:13+00:00 2026-05-26T00:53:13+00:00

I have two Person and PersonDTO classes and I’m using NHibernate to save these

  • 0

I have two Person and PersonDTO classes and I’m using NHibernate to save these objects. As while as I have One user there is no problem and as soon as another user is going to update the object that another user is updating it. then Both of the can update the same object and because it is updated by another user, on of the changes will lost.

In order to implement cuncurrency I used two ways that both of them faced with problem.

  • The first solution : Use the Person constructor to update the object
  • The second approach : Using a GetByID method

The first approach is working great with any problem but unfortunately I don’t have enough permition to the Load Person completetly with its dependencies. so that I have to use the second approach.

In the second approach when I set (update) Version it is o up to the last second, but NHibernate is using its old Version so that my changes won’t apply.

Look at the following Code

load a Person by ID

person = locator.PersonRepository.GetById(dto.Id);

Version field is loaded by new value. but I need to set it from my PersonDTO object

person.Version = dto.Version

During update process NHibernate passes old value to sql and I don’t face with concurreny error.

What should I do to implement concurrency in this way.
Any help is appriciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:53:13+00:00Added an answer on May 26, 2026 at 12:53 am

    As I understand your problem, I guess You have a field that its getter works fine but when you are trying to set it you face with problem, if it is so, then check the following considerations

    • Check if your Version field that is not Readonly
    • Check if it has a public setter not a private one
    • Check if you have needed properties in your Mapper
    • Check what is happening in your Person constructor that is not raise when you use GetByID method

    provide more information if these ideas didn’t help you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two classes public class Person { } public class Company {
I have two classes one called Person the other called Student I have been
I have two objects of classes Person and Employee. Both classes have common attribute
I have two tables called Person and Address . These tables I mapped one
I have two similar classes : Person , PersonDto public class Person { public
I am really confused about object relationships! I have two classes Person and Address.
I have two classes Company CompanyKey CompanyName Person FirstName LastName CompanyKey The list items
I have two classes (Person and Address) that i need to send via wcf,
Let's say you have two classes, Person and Address. Person has a reference to
I'm still struggling with this concept. I have two different Person objects, very simply:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.