*
The moose likes EJB and other Java EE Technologies and the fly likes Delete entity, good way to unwire/unassociate from another entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Delete entity, good way to unwire/unassociate from another entity" Watch "Delete entity, good way to unwire/unassociate from another entity" New topic
Author

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

Theodore David Williams
Ranch Hand

Joined: Dec 21, 2009
Posts: 102
Given the following 2 tables:
Car
- Id
- Name
- Engine_Id

Engine
- 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?

Thanks.
 
wood burning stoves
 
subject: Delete entity, good way to unwire/unassociate from another entity
 
Similar Threads
Exception on cascade of remove in a unidirectional @OneToMany
Hibernate POJOs -- association or no-association ?
hibernate:many-to-many the association table is not getting populated
doubt in one-to-one association mapping
mapping One-to-many relationships using NetBeans and Not Hibernate