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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:36:48+00:00 2026-06-08T07:36:48+00:00

I have a table called article with the following columns in the below order:

  • 0

I have a table called article with the following columns in the below order:

article table:

1)creator_id
2)article_id(pk)
3)…..

article_page table:

1)article_page_id(pk)
2)article_page_number
3)article_id(fk –> article table ).

Im using either unidirectional or bidirectional hibernate annotation mapping and the following problem occurs when i’m trying to save an article object that has many article_page objects calling save():

The article is inserted in the table article and a new article_id is generated. But when trying to insert rows in the article_page table hibernate is trying to use the creator_id from the table article instead of the article_id.

I have double checked my java annotated classes and I don’t seem to find any mistake. I was wondering if creator_id being in position 1 of the PostgreSQL article table causing this strange behavior. Or is it something else?

  • 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-08T07:36:49+00:00Added an answer on June 8, 2026 at 7:36 am

    Ok it seems that all the columns of my table article are considered auto-generated so they all get returned in the getGeneratedKeys() call. The order in which the columns exist in the table article is the order in which you can retrieve them form the GeneratedKeys. In our case my primary key is returned through getInt(2) since its the second in order.

    Hibernate 3.5 as it seems retrieves as a primary key the first column.

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

Sidebar

Related Questions

I have table called articles_tags which have two columns: article_id tag_id (has_and_belongs_to_many association) (I
I have a table called ProjectRegion. It has two columns, an id and a
I have a table called scheduler_sched which has several columns, including a column called
I have a table called Articles. it includes the following field: ArticleIndex, ArticleLevel, ArticleParentIndex.
I have a databse table called article with three fields(Id, Title, Text). I am
Lets say I have a table in MySQL called articles, that has a column
I have table called stats . In am inserting yes or no in the
i have table called as Support, which have a field named Name and contains
I have table called Buttons. Buttons table i have column button_number . Table contain
I have table called posts in my DB. Each post has field called social_network

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.