About Question enthuware.oce-jpad.v6.2.444 :

Moderator: admin

Post Reply
piotr.kraciuk
Posts: 9
Joined: Sat May 09, 2015 6:30 am
Contact:

About Question enthuware.oce-jpad.v6.2.444 :

Post by piotr.kraciuk »

What about situation, when more than one person (or any other entity) has associated the same address in addresses list?

I assume address like that wouldn't become orphaned after remove of one person, and thus part "all the associated addresses are removed as well" would not be true with option 3.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by admin »

The problem statements clearly says that it is a unidirectional one-to-many. So same Address cannot be referred to by multiple Persons.
If you like our products and services, please help us by posting your review here.

piotr.kraciuk
Posts: 9
Joined: Sat May 09, 2015 6:30 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by piotr.kraciuk »

You're right:) But what about situation, when this Address is in relation to some other Entity?

Lets say, that we have entity Letter, with the same Address assigned. Person with this address is removed, but Letter with this address remains in the database. Wouldn't option 3 be false then?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by admin »

Orphan delete implies that Person is the owner of Address. If you are associating the same address with another entity then that means you have a problem in your relationships! The address entity will be removed as per the orphan delete policy when you delete a person.
If you like our products and services, please help us by posting your review here.

piotr.kraciuk
Posts: 9
Joined: Sat May 09, 2015 6:30 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by piotr.kraciuk »

Thank you for for clarification.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by himaiMinh »

In the previous post:
But what about situation, when this Address is in relation to some other Entity?
Example, Employee 1 is living at Address 1. Employee 2, who is a spouse of Employee 1 is also living at Address 1. If Employee 1 quit the company, Employee 1 should be removed. Employee 2 stays with the company. Therefore, Address 1 should not be removed in the database.
In this situation, we don't want to cascade the remove in the Address.
In this case, a join table can be used like this:
Table : Employee_Address
Employee_ID (pk, Fk) Address_ID (PK, FK)
1 1
2 1
where pk's is composite primary key of the join table , FK is foreign keys referring to Employee and Address's primary keys.

__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.444 :

Post by __JJ__ »

piotr.kraciuk wrote:
Sun Aug 09, 2015 1:30 pm
What about situation, when more than one person (or any other entity) has associated the same address in addresses list?
Then that address wouldn't be an orphan. orphanRemoval=true as the name suggests is intended to remove orphans.

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests