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

  • Home
  • SEARCH
  • 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 6150229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:35:16+00:00 2026-05-23T19:35:16+00:00

You create a bidirectional one-to-one relationship using fields on both classes, with an annotation

  • 0

You create a bidirectional one-to-one relationship using fields on
both classes, with an annotation on the child class’s field to declare
that the fields represent a bidirectional relationship. The field of
the child class must have a @Persistent annotation with the argument
mappedBy = “…”, where the value is the name of the field on the
parent class. If the field on one object is populated, then the
corresponding reference field on the other object is populated
automatically.

What can a bidirectional one-to-one relationship do?


Can someone give me a example?

And why I always got this error.

Class “com.example.datastore.Employee” has field “contactInfo” with
“mapped-by” specified as “contactInfo”. This field doesnt exist in the
target of the relation (“com.example.datastore.ContactInfo”)!!

Thanks in advance!

  • 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-23T19:35:17+00:00Added an answer on May 23, 2026 at 7:35 pm

    First the Error
    What the error is saying is that contactInfo is not a field of class com.example.datastore.ContactInfo . They field mapped by must be a field\property of the class you are mapping to .

    Second The concept of Bi-Direction Mapping

    It’s just that two tables in one-to-one or one-to-many relationship where both entities will have knowledge of the other s. You do not always need it and that depends on situation and context but generally is more common to have bi-directional one to many than one to one.
    You question is about one-to-one so to give you an example of when both entities need to know about each other from Hibernate docs A bidirectional one-to-one association on a join table is possible, but extremely unusual. But if you really wanted to be able to get either entiy from which ever table (which is very rare) then you create bi-directional one to one

    Person and Address just to quote an example

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

Sidebar

Related Questions

i have one doubt, that is when we create one-to-many as bidirectional. we will
Basic question : How to I create a bidirectional one-to-many map in Fluent NHibernate?
To my understanding a Unidirectional one-to-many relationship has a join table and a Bidirectional
I had a similar question to Fluent NHibernate: How to create one-to-many bidirectional mapping?
While trying to create a Bi-directional one-to-one mapping in NHibernate, I found that, I
Create Pex test to test a DLL and hardware controlled by that DLL? I
CREATE TABLE #Report( Cell int, CellValue double) Error here DECLARE @Report TABLE ( Cell
I have the following annotated Hibernate entity classes: @Entity public class Cat { @Column(name
Why can i remove elements of a bidirectional relation although only one side of
I have a system created that a user at one of our other locations

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.