Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

OneToMany/ManyToOne mapping, children are not deleted with update (PUT)

Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm still struggling and fighting to get a OneToMany/ManyToOne working. The examples I have found till now, have the same issue and I have also found here the question but not the solution or I do not understand it.

I have the two Entities:
parent Employee @OneToMany:The Child side: @Many-To-One:

The update employee service implementation:

And this is what I inject with Postman the create (POST):

I have two "employeeModelLogging" records at the time of creation of an Employee.

Now I do an update with postman:

When I execute the update, than there are still two records in the database. (It is not a problem to update fields from the employee or department, etc. This is working fine)

I have tried this, by removing the second recordThe second loggingModel is removed from the JPA I think, but not in the database. But I this, if this should work, than at least I know which way I have to go...

I hope that someone has an idea and can tell me what I'm doing wrong...
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic