This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes deleting entity with many-to-one association 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 » Databases » Object Relational Mapping
Bookmark "deleting entity with many-to-one association" Watch "deleting entity with many-to-one association" New topic

deleting entity with many-to-one association

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228

I have two java classes and

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
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Why not just get the phoneNumber, and then call a delete on it? That would delete the object itself.

-Cameron McKenzie
subject: deleting entity with many-to-one association
Similar Threads
Array? Arraylist?
Making multiple files from single file
Native contact list
Enthuware's Mock Exams and My telephone number
Input From Console