• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Orphan delete doesn't seem to be working properly

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to set up an assocition using the hibernate "delete orphan" option. I believe I have all the annotations correct after cross referencing the hibernate book. However after removing the item from the collection, Hibernate is attempting to set the foreign key to null. Which violates a database constraint. Hibernate has been told about the not-null constraint...

Here's my code:

Competition.java

Event.java


Consuming code (In actuality its a Struts 2 action using preparable and custom type converters, here I've localized all the relevant code and have tests that it gives the same error as my actual architecture. But felt I had to explain the combination of repositoty and direct entityManager access...)


Error:


I had thought that the combination of the DELETE_ORPHAN on the owning side of the association and the nullable=false on the owned side would have prevented hibernate from attempting that update. What am I doing wrong?
 
Eric Nielsen
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am really stumped on this. Please, does anyone have any idea what I'm doing wrong? Or what other information is needed to help diagnose the problem?
 
I don't even know how to spell CIA. But this tiny ad does:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic