About Question enthuware.oce-jpad.v6.2.444 :
Moderator: admin
-
- Posts: 9
- Joined: Sat May 09, 2015 6:30 am
- Contact:
About Question enthuware.oce-jpad.v6.2.444 :
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.
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.
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
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.
-
- Posts: 9
- Joined: Sat May 09, 2015 6:30 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
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?
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?
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
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.
-
- Posts: 9
- Joined: Sat May 09, 2015 6:30 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
Thank you for for clarification.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
In the previous post:
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.
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.But what about situation, when this Address is in relation to some other Entity?
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.
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.444 :
Then that address wouldn't be an orphan. orphanRemoval=true as the name suggests is intended to remove orphans.piotr.kraciuk wrote: ↑Sun Aug 09, 2015 1:30 pmWhat about situation, when more than one person (or any other entity) has associated the same address in addresses list?
Who is online
Users browsing this forum: No registered users and 3 guests