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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:32:48+00:00 2026-05-25T16:32:48+00:00

I have two tables to store answers and HTML template of a form. Table

  • 0

I have two tables to store answers and HTML template of a form. Table answers has foreign key whih refers to primary key in html_templates table. There is a problem when I try to add a record to answer table.

//session opened
    Answers answers = new Answers();
    answers.setAnswer("answer...");
    //there is a record in getHtmlTemplates with 4 as an id
    answers.setHtmlTemplates(getHtmlTemplates(4));
    session.save(answers);

Program executes without any warrings, but there is no record in DB (MySql). When I am adding a record to answers manually, the id is incremented by more than one. Actually when all operations are within transaction a record is added. What happened? It looks like DB database has deleted this record.

  • 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-25T16:32:48+00:00Added an answer on May 25, 2026 at 4:32 pm

    It’s likely that you are not committing the transaction. For auto-increment columns like MySQL uses, the save method causes a dummy record to be inserted so that Hibernate can retrieve the new ID value (notice that save returns an object, which is the new ID). MySQL has now marked that value as being used, which is why it looks like the ID has “jumped” when you manually insert.

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

Sidebar

Related Questions

I have two tables that store value as VARCHAR . I'm populating table and
I have two tables which are used to store details of different types of
I have two sql tables for user login, store and retrieve data according to
I have a planning structure on two tables to store available slots by day,
I have two tables: table a ida valuea 1 a 2 b 3 c
I have two tables: CREATE TABLE `digits` ( `digit` tinyint(3) unsigned NOT NULL, `group`
I have two tables - users and stores . there is a third table
I have two tables, NetworkAccount and Division. The are related by DivisionID NetworkAccount has
I have seen people often use a separate table to store relations between tables.
I have two tables, DUMMY_REK and DUMMY_REK_LOG. I have written a store procedure to

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.