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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:51:32+00:00 2026-05-26T22:51:32+00:00

See this question . It turns out that even without committing the transaction manually,

  • 0

See this question.

It turns out that even without committing the transaction manually, before the TX is committed, the person has an ID after calling the save() method.

Isn’t the database responsible of assinging the ID field? If so, how can the ID field be filled before commit? Does any communication with the DB occur before the TX is committed?

  • 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-26T22:51:33+00:00Added an answer on May 26, 2026 at 10:51 pm

    Yes, the JPA is allowed to communicate with the DB before transaction commit. It can occur i.e. when you explicitly invoke EntityManager#flush().

    Moreover, the JPA provider is allowed to do the flush operation whenever it feels it’s necessary. However, by the convenience, JPA providers delays DB operations to the time the transaction will be committed.

    Some automatic ID generator strategies must hit the database to get the PK value (as far as I remember the IDENTITY strategy works that way).
    As a contrary, the TABLE or SEQUENCE generators don’t necessary need to hit the DB to get the ID value. They use the allocationSize parameter to ask the DB TABLE or SEQUENCE for a batch of IDs that will be given to new entities without further communication with the database.

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

Sidebar

Related Questions

I see this question here on SO but I am not sure that answers
In this question I see that microsoft ships the XML documentation files for the
I see that over on this question LINQy way to check if any objects
I've done a good search to see if anyone else has asked this question,
This question has been asked before but 1) the user never accepted an answer
According to this page in MSDN, turns out that the accessibility of a specific
Per this question (see comments near the bottom), I was wondering if anyone knows
As you can see this is a question from a non web developer. I
See the title of this question. I want to play with the exception raised
Update: See the bottom of this question for a C# workaround. Hi there, Consider

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.