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 8717325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:16:43+00:00 2026-06-13T06:16:43+00:00

I have a relatively simple problem, which I cannot tackle without a lot of

  • 0

I have a relatively simple problem, which I cannot tackle without a lot of ugly workarounds. Basically, I am developing a payment gateway client, whereby the process is that the website informs the payment server of the payment to be done, client is transferred to payment server, and once payment is done, payment server informs the website on a seperate thread that the payment was done, and redirects the client. Now, the client can be ‘received’ on the website before the notification of the payment was received. Thus, I need to program the system to wait until the notification is received or 30 seconds at most.

Once the notification is received, an Order entity is marked as ‘Paid’. The problem is this:

  • Client is redirected to website before, Order.Paid is still false
  • After 1 – 5 seconds, notification is received and Order is marked as true
  • Due to Nhibernate session management, Client still sees the Order.Paid as false on the other thread.
  • To make matters worse, sometimes the client’s Order is then flushed on End_Request, and the Order.Paid is again reset to false.

The only way I tried that seems to work is that I dispose of the Nhibernate session explicitly before waiting, and then constantly create a new session until it is found as paid. However the problem is since the original session was removed, lazy loading for any entities already loaded before hand will stop working and generate errors.

It looks simple in my mind but yet seems to be quite complicated due to session management, any ideas how to go about it?

Thanks!

  • 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-06-13T06:16:44+00:00Added an answer on June 13, 2026 at 6:16 am

    From the time I posted the question, I’ve managed to find a solution to this.

    Basically, how NHibernate works – If any exception occurs on a session, the session must be disposed. This also applies to StaleObjectException, when using optimistic concurrency. The reason the client was still seeing is as ‘not paid’ was because the session was not being disposed.

    A book snippet on Google Books explains this in a bit more detail:
    http://books.google.com.mt/books?id=eMOYUycDaoUC&pg=PT213&lpg=PT213&dq=nhibernate+staleobjectexception+dispose&source=bl&ots=rg9YHt58gc&sig=W9FoTm8_4DT3PvMKGLrddG3lSxs&hl=en&sa=X&ei=FGp-UNr4FI7Vsga2nIDwBw&ved=0CGAQ6AEwCA

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

Sidebar

Related Questions

I have a relatively simple problem. I have a model named Item which I've
I have a computational geometry problem that I feel should have a relatively simple
I have a relatively simple class which deletes a post: function delete_post($postid, $reason){ //Stuff
I have a relatively simple application which I need to make native Mac OSX
I have a relatively simple question that I cannot seem to find the answer
I have a relatively simple problem bat as yet I haven found the most
I have a problem with a relatively simple query and the execution plan Access
A relatively simple question. I have a datagridview, which all it does is displays
I have a set of classes and interfaces which have a relatively simple hierarchy,
I have a relatively simple form which asks a variety of questions. One of

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.