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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:13:57+00:00 2026-06-05T07:13:57+00:00

Within my application I have a process which takes some time (30s – 5mins)

  • 0

Within my application I have a process which takes some time (30s – 5mins) and during that time manipulates database via JPA.

My problem is that I want to set the state of the process to its db entity:

 void runProcess(Process process) {
     process.setState("Started.");
     em.merge(process);

     ... db manipulations

     process.setState("First phase finished.");
     em.merge(process);

     ... db manipulations

     process.setState("Process finished.");
     em.merge(process);
 }

The problem is that only first update takes place and the others stay ignored.

I don’t get any errors and Hibernate logs I can see process update three times:

 Hibernate: update process set state=? where id=?

But only the first update will take place.

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-05T07:13:58+00:00Added an answer on June 5, 2026 at 7:13 am

    Changes made to entities are made in memory, and are only written to the database at flush time (typically, at the end of the transaction).

    And even if a fluch is made before the end of the transaction, or if you flush after each process state update, other concurrent transactions have a good chance of not seeing the new state, because transactions are isolated from each other, and the default isolation level is, most of the time, READ_COMMITTED (which means other transactions only see the changes once they are committed).

    If you want to make the process state definitely written to the database, you need to write this state in a separate transaction.

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

Sidebar

Related Questions

I have a .net web service that takes some xml data. From within the
I have a GUI application within which i'm spawning a console application using Process
Within my iPhone application I have a common tab bar with three tabs that
I have a Web page within my application that needs to call a web
I have an application that is launched from within a service using a local
I have a WPF application which has a DirectX component within it. This component
I am not sure if this is possible...i have code within my application which
In my application, I have a process which forks off a child, say child1,
I have an application that receives files with a flat table in DBF, which
I am implementing instrumentation within an application and have encountered an issue where the

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.