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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:49:39+00:00 2026-06-11T22:49:39+00:00

I am looking for some clarification on when to use the aforementioned relationships. As

  • 0

I am looking for some clarification on when to use the aforementioned relationships.

As an example i have a class A which is referenced by instances of class B.

Should this relationship be modelled OneToMany and have a collection of class B defined in class A or be modelled by ManyToOne and have a reference to class A in class B?

My question is whether the choice of relationship is entirely up to the programmer, or application dependent or JPA dependent?

  • 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-11T22:49:40+00:00Added an answer on June 11, 2026 at 10:49 pm

    OneToMany and ManyToOne are two sides of the same coin. If the association is unidirectional (that is, it’s not bidirectional) then the choice of relationship is the same as choosing which side owns the relationship. Examples:

    • You want a unidirectional relationship from 1 A to many Bs, where A is the owner. The only choice is OneToMany.
    • You want a unidirectional relationship from 1 A to many Bs, where B is the owner. The only choice is ManyToOne.

    If the association is bidirectional then, by assumption, you’re using both OneToMany and ManyToOne. Choosing the owner side does not force you to make an either-or decision.


    More reading @ The Java EE 6 Tutorial: Entities.

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

Sidebar

Related Questions

I'm looking for some clarification regarding the behaviour of redirect_to . I have this
looking for some help with images referenced within the stylesheet. I have no problems
Just looking for some clarification, as I am still new to all of this:
I am looking for some clarification with regards to view controllers and views. Should
Looking for some guidance on a WCF service I’m prototyping. I have a WCF
So I'm looking for some clarification how it would be possible to remove the
Need a clarification while looking at calculating a running checksum. Assume I have data
Looking around Google I can see a few people have asked this but there
Just looking for some clarification with the new play button. I notice that when
I'm fiddling with a bit of c++/opencv. I was looking some of the samples

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.