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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:45:02+00:00 2026-05-11T20:45:02+00:00

I am using a combination of Spring 2.5.6 and Hibernate Annotations. I have three

  • 0

I am using a combination of Spring 2.5.6 and Hibernate Annotations. I have three objects(tables or w/e) under consideration: Customer, Address, Order. Customer has the Cascade DELETE_ORPHANS property set for addresses.

What i am doing is a customer merge, i’m moving all addresses and orders from one customer to another, then setting a disabled bit on the old customer. I do this by removing addresses from CustB and adding them to CustA. Then i save CustA with .update(custA), the addresses and orders move appropriately, but when I update custB with the disabled bit it erases my moved addresses!

When i comment out the DELETE_ORPHANS it works fine.

How do I stop DELETE_ORPHANS from removing the moved addresses? Should I not remove them from the custB and just change their customer reference? If i do it all within a transaction insead of detaching the objects inbetween each operation will they update properly with DELETE_ORPHAN enabled?

  • 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-11T20:45:02+00:00Added an answer on May 11, 2026 at 8:45 pm

    I found this post on hibernate’s forums: https://forum.hibernate.org/viewtopic.php?f=1&t=961777&start=0

    Christian from the hibernate team talks about DELETE_ORPHANS as a hack that ensures hibernate that when the associated is removed from an object it is ok to delete. He says to use this sparingly.

    Basically, don’t use delete_orphans if you can help it.

    If you do decide to use it, you’ll have to do extra queries that delete entries then re-create them with new identifiers attached to the new parent objects.

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

Sidebar

Related Questions

Domain Description I am using a combination of Spring + Hibernate + Tuckey Urlrewrite
I'm using spring based validation in combination with hibernate validator enabled by the following
I'm using Spring/Hibernate combination for my project, with standard CRUD operations. I wonder, is
I'm using Wicket in combination with Spring and Hibernate, at least that's what I'm
I have a very rough workaround for 10 statements using a combination of 2
All these years i have been successfully using EnumServicesStatus in combination with OpenScManager (with
I'm using JPA 2.0/Hibernate validation to validate my models. I now have a situation
I am new to struts2, prior to this I have been using struts1.2, Spring
I tried to use BoneCP with my JSF-Spring-Hibernate combination, following BoneCP configurations on their
For some reason I get the following exception when using Spring Batch in combination

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.