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

  • Home
  • SEARCH
  • 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 7071635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:42:43+00:00 2026-05-28T05:42:43+00:00

i have multiple users. To prevent concurrency, i write something like that: @EJB PersistenceManagerRemote

  • 0

i have multiple users. To prevent concurrency, i write something like that:

@EJB
PersistenceManagerRemote persistenceManager;

persistenceManager.lock(decidableEntity, LockModeType.READ);
persistenceManager.refresh(decidableEntity);

this worked for me. However, if i persist something and then i call this code in the same transaction then i got en error.

 javax.persistence.PersistenceException: org.hibernate.HibernateException: this instance does not yet exist as a row in the database

When i persist an entity, database context is not effected until the transaction finishes. So when i refresh, it tries to find the entity on database, so error arises. Do you have a solution? I cannot divide into two transaction. I should also consider concurrency. What can i do?

  • 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-28T05:42:43+00:00Added an answer on May 28, 2026 at 5:42 am

    You need to call em.flush() to write all the pending changes to the database. persist() only makes a transient entity attached to the persistence context. Hibernate only flushes when necessary, in order to avoid them if they’re not, and to be able to send then into a batch.

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

Sidebar

Related Questions

I have an ASP.NET application that uses Session.SessionID to prevent multiple users viewing the
I have a datatable that contains rows of transaction data for multiple users. Each
I have various Java Swing applications that are used by multiple users. My deployment
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
We frequently have users that create multiple accounts and then end up storing the
I have a web page that sends email to multiple users (online distribution list).
I have a button that plays a sound and i want to prevent users
Here's the situation: I have a web-based ticket application, multiple users. One problem that
I have multiple Users, each with a collection of Tasks. public class User {
If yo have multiple users on your website on the same page and they

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.