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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:11:41+00:00 2026-06-12T03:11:41+00:00

I have more of theoretical question: When data gets inserted into a database? is

  • 0

I have more of theoretical question:
When data gets inserted into a database? is it after persist or after commit is called? Because I have a problem with unique keys (manually generated) – they get duplicate. I’m thinking this is due multiple users inserting data simultaneously into a same table.

UPDATE 1:

I generate keys in my application. Keys example: ‘123456789123’,’123456789124′,’123456789125’…

Key field is varchar type, because there are lot of old keys (I can’t delete or change them) like ‘VP123456′,’VP15S3456’. Another problem, that after inserting them into one database, these keys have to be inserted in another database. And I don’t know what are DB sequences and Atomic objects..

UPDATE 2:

These keys are used in finance documents and not as database keys. So they must be unique, but they are not used anywhere in programming as object keys.

  • 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-12T03:11:43+00:00Added an answer on June 12, 2026 at 3:11 am

    I would suggest you create a Singleton that takes care of generating your keys. Make sure you can only get a new id once the singleton has initialized with the latest value from the database.

    To safeguard you from incomplete inserts into the two databases I would suggest you try to use XA transactions. This will allow you to have all-or-nothing inserts and updates. So if any of the operations on any of the databases fails, everything will be rolled back. Of course there is a downside of XA transactions; they are quite slow and not all databases and database drivers support it.

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

Sidebar

Related Questions

This is more of a theoretical question than an actual problem I have. If
This is more of a theoretical question. If I have an arbitrary collection c
This is a more theoretical question, not a specific scenario: Let's assume, we have
this is more theoretical question. I have written simple chat with my friend. We
while programing bellman-ford algorithm I encountered one problem, it's question more theoretical than technical
This is more of a theoretical question than a specific one. I have a
This is more of a theoretical question than anything. I have 3 dictionaries that
This is more of a theoretical questions. Anyways, Assume that I have a database
This may be more of a theoretical question. I have a scenario wherein there
I have more than 100 million unique strings (VARCHAR(100) UNIQUE in MySQL database). Now

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.