A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
deleting entity with many-to-one association
Joined: Jun 03, 2005
Aug 27, 2008 10:55:00
I have two
classes Contact.java and PhoneNumber.java
Contact has a many-to-one relationship with PhoneNumber.
My question is if the user deletes the phone number from UI it should be delete from database. To achive this i am doing
this code is deleting the phone number reference from contact but not deleting the record from the phone number table. How to achive this?
Cameron Wallace McKenzie
author and cow tipper
Joined: Aug 26, 2006
Sep 02, 2008 16:38:00
Why not just get the phoneNumber, and then call a delete on it? That would delete the object itself.
I agree. Here's the link:
subject: deleting entity with many-to-one association
Making multiple files from single file
Native contact list
Input From Console
Enthuware's Mock Exams and My telephone number
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014