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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:45:27+00:00 2026-05-25T18:45:27+00:00

I wanted to clarify an assumption that I have made, regarding the functionality of

  • 0

I wanted to clarify an assumption that I have made, regarding the functionality of Hibernate. Assume I have a Class of A‘s with a @OneToMany mapping with B‘s. These B’s each have an A parent reference to support a mappedBy attribute on A.

When I remove a B from the collection in A, does hibernate have the ability to automatically null out the parent field inside of B?. From all of the tests I have done, when removing something from a collection, it doesn’t actually update the database by changing the parent reference in the child.

This link seems to support my claim as they manually null out the parent reference, along with removing it from the parent Set.

  • 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-25T18:45:28+00:00Added an answer on May 25, 2026 at 6:45 pm

    Whenever an association is mapped from both ends, one of these ends is designated the active, and one the passive end. (The passive end is the one mapped using mappedBy= or inverse="true")

    Hibernate does not, and can not, update the passive end of a collection when the active end is changed, as it can detect such changes only at flush time. Hence it is considered good practice for calling code to modify both ends of the association, to ensure the object model is always in a consistent state.

    Hibernate itself does not care whether the two ends of the association are consistent, as it only looks at the active end when flushing to the database.

    When mapping a one-to-many association, the one-to-many end should be designated passive. The section from the hibernate manual you link to attempts to explain why.

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

Sidebar

Related Questions

I just wanted to clarify if a hard/symbolic link is actually a file that
I have implemented my own drop down menu and wanted to clarify the accessibility
I have a Java program that executes Runtime.getRuntime().exec(ls -l); many times, once for each
I wanted some of those spiffy rounded corners for a web project that I'm
I wanted to know if we can access the HttpContext class in the App_Code
I wanted to write a small script that searched for an exact file name,
I'm working on a program that renders iterated fractal systems. I wanted to add
just wanted to clarify the options for client presentation : 1) winforms - for
I wanted to normalize my table to all 3NF I believe that all of
I am working on an SQL statement and just wanted to clarify my understanding

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.