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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:11:08+00:00 2026-06-05T06:11:08+00:00

I’m developing an information system and there is something I don’t know how to

  • 0

I’m developing an information system and there is something I don’t know how to deal with.
Let’s say my website allows admin to edit users. When two administrators want to edit the same user at the same time, the administrator who clicked edit later then the first one shouldn’t be allowed to.

So I want a transaction to be opened when the administrator clicks on the edit button and committed when they send the edited form.

One solution that I can think of is to put EntityManager in a Named ConversationScoped CDI bean. But I don’t think this is a good solution since the presentation tier sould be separated from the business tier and database access belongs to the business tier.

Another solution could be to put EntityManager in a Stateful bean and manage transaction from a Named ConversationScoped CDI bean that would call methods on the Stateful bean. But is managing transactions in the web tier a good idea? What if I decided to have my business tier deployed on another application server, would managing transaction on a remote EJB work? And what If the EJB went passivated, would the transaction be lost?

This is also related to another problem, when you retrieve an object from the database with EntityManager, it gets detached as soon as the transaction is closed. If the object have some lazy initialized fields, the web tier cannot access them because when the object is returned to the web tier, it’s detached. So you can either manage transactions in the web tier or iterate through the lazy initialized fields in the business tier. The former solution seems to be incorrect and the later can get very verbose and complicated.

I know I’m asking too many questions but I really want to know how to do this properly.

I have available these technologies: CDI, Seam 3 and EJB.

Of course if you know a better solution, I’d be happy to hear it.

Thank’s in advance.

  • 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-05T06:11:10+00:00Added an answer on June 5, 2026 at 6:11 am

    JPA optimistic locking mechanism solves this (see @davidfrancis comment).

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.