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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:15:03+00:00 2026-06-09T12:15:03+00:00

I am working with some old hibernate code, and need to update and create

  • 0

I am working with some old hibernate code, and need to update and create a one to one.

I have a table

Table_1
PK table_1_id
FK table_2_id

Table_2
PK table_2_id

How do I map these in hibernate XML files so that the relationship is unqiue.. I have tried the

<many to one ... unique='true'>

but that does not work as it allows two records from table_1 to reference one row from table_2

  • 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-09T12:15:05+00:00Added an answer on June 9, 2026 at 12:15 pm

    This is the proper way, as documented in the documentation.

    Hibernate will never prevent two records from table_1 to reference one the same row from table_2. That’s the role of the unique constraint that you should add on the table_2_id column of table_1, in the database.

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

Sidebar

Related Questions

I have some working code with a crutch to add BOM marker to a
I'm working on some old code and I found that I used to use
The project that I've been working on involves porting some old code. Right now
I was working with some old code (a text game, as it happens) and
I'm working with some old PHP code that has a lot of the following:
I am working with some old code and it defines a global variable like
Hi i've been working on a task of porting some code from some old
I am working on some OLD (as in older than me) C code that
I was working with some legacy code today and noticed something strange. We have
I am working on editing some old C++ code that uses global arrays defined

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.