Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Delete entity, good way to unwire/unassociate from another entity

Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the following 2 tables:
- Id
- Name
- Engine_Id

- Id
- Type

The relationship is a one to one for car to engine and the car table has a foreign key to engine table.

When I delete an engine:

I will run into problems if I do not remove the association to the car so i need

I was hoping that I could use a PreRemove to make this a little more clean, but I do not think it works with the foreign key in Car

Is there anything I can do that would 'automatically remove the engine_id foreign key in the car table when I delete and engine?

To get a wish, you need a genie. To get a genie, you need a lamp. To get a lamp, you need a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic