Updating inverse side bidirectional association The Next CEO of Stack OverflowDatabase design...
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
Term for the "extreme-extension" version of a straw man fallacy?
The King's new dress
Why did we only see the N-1 starfighters in one film?
Can a single photon have an energy density?
Why do professional authors make "consistency" mistakes? And how to avoid them?
Anatomically Correct Strange Women In Ponds Distributing Swords
How to start emacs in "nothing" mode (`fundamental-mode`)
Is it safe to use c_str() on a temporary string?
Natural language into sentence logic
Customer Requests (Sometimes) Drive Me Bonkers!
Why does C# sound extremely flat when saxophone is tuned to G?
Grabbing quick drinks
Is a stroke of luck acceptable after a series of unfavorable events?
How to write papers efficiently when English isn't my first language?
Unreliable Magic - Is it worth it?
Opposite of a diet
Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis
Why does standard notation not preserve intervals (visually)
What does this shorthand mean?
Rotate a column
How to be diplomatic in refusing to write code that breaches the privacy of our users
What can we do to stop prior company from asking us questions?
Updating inverse side bidirectional association
The Next CEO of Stack OverflowDatabase design for changing number of fieldsSchema for an RBAC (Role-based Access Control System)Can triggers be used to implement automated polymorphic association?incorrect result when filtering by associationPerformance impact of NOT using a foreign key (many dedicated 1:many key-key tables vs non-fk generic key-key table)Storing revisions and relations between revised items in 1:N and N:N scenarios for auditsNormalize repeated indefinite ongoing dates for an eventDB Design ChallengeWhat's the overhead of updating all columns, even the ones that haven't changedCan the Chase test algorithm only modify attributes on the right side of a functional dependency?
I understand (more or less) the concept of unidirectional
and bidirectional
association in a relationship, but I don't see the correct practical application of it.
For example, I want an contact
table which contains a FK for the country
, so I don't have to store the countries every time I create an address but just keep a reference to an already existing country.
As far as I understand, this should be a ManyToOne
relationship contact(M) --> country(1)
as one contact
can only have one country
but one country can be used by many contacts. This makes contacts the ONWING
side of the relationship and country the INVERSE
side as contact will hold the FK.
In the Doctrine documentation I read that it will only look after changes in the owning side. Does this mean that the table contact won't be updated if a country ID changes, which is exactly what I want it to do?
Also, what I would need is to get the country name to join it in the contact entry and not in reverse. This is the purpose of the bidirectional association, right?
Hope not be messing things up (too much)
mysql relational-theory orm
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I understand (more or less) the concept of unidirectional
and bidirectional
association in a relationship, but I don't see the correct practical application of it.
For example, I want an contact
table which contains a FK for the country
, so I don't have to store the countries every time I create an address but just keep a reference to an already existing country.
As far as I understand, this should be a ManyToOne
relationship contact(M) --> country(1)
as one contact
can only have one country
but one country can be used by many contacts. This makes contacts the ONWING
side of the relationship and country the INVERSE
side as contact will hold the FK.
In the Doctrine documentation I read that it will only look after changes in the owning side. Does this mean that the table contact won't be updated if a country ID changes, which is exactly what I want it to do?
Also, what I would need is to get the country name to join it in the contact entry and not in reverse. This is the purpose of the bidirectional association, right?
Hope not be messing things up (too much)
mysql relational-theory orm
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I understand (more or less) the concept of unidirectional
and bidirectional
association in a relationship, but I don't see the correct practical application of it.
For example, I want an contact
table which contains a FK for the country
, so I don't have to store the countries every time I create an address but just keep a reference to an already existing country.
As far as I understand, this should be a ManyToOne
relationship contact(M) --> country(1)
as one contact
can only have one country
but one country can be used by many contacts. This makes contacts the ONWING
side of the relationship and country the INVERSE
side as contact will hold the FK.
In the Doctrine documentation I read that it will only look after changes in the owning side. Does this mean that the table contact won't be updated if a country ID changes, which is exactly what I want it to do?
Also, what I would need is to get the country name to join it in the contact entry and not in reverse. This is the purpose of the bidirectional association, right?
Hope not be messing things up (too much)
mysql relational-theory orm
I understand (more or less) the concept of unidirectional
and bidirectional
association in a relationship, but I don't see the correct practical application of it.
For example, I want an contact
table which contains a FK for the country
, so I don't have to store the countries every time I create an address but just keep a reference to an already existing country.
As far as I understand, this should be a ManyToOne
relationship contact(M) --> country(1)
as one contact
can only have one country
but one country can be used by many contacts. This makes contacts the ONWING
side of the relationship and country the INVERSE
side as contact will hold the FK.
In the Doctrine documentation I read that it will only look after changes in the owning side. Does this mean that the table contact won't be updated if a country ID changes, which is exactly what I want it to do?
Also, what I would need is to get the country name to join it in the contact entry and not in reverse. This is the purpose of the bidirectional association, right?
Hope not be messing things up (too much)
mysql relational-theory orm
mysql relational-theory orm
asked Aug 6 '15 at 18:40
lusoluso
1085
1085
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Huh? Sounds like the textbooks are making things too complicated, with too much terminology.
Yes, "country" involves a many:1 relationship. Yes there are 2 tables. Yes, country_id
is in both tables. OK, you could have a FK relationship. Or you could simply make sure you insert into Countries
whenever you come across a new country
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f109270%2fupdating-inverse-side-bidirectional-association%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Huh? Sounds like the textbooks are making things too complicated, with too much terminology.
Yes, "country" involves a many:1 relationship. Yes there are 2 tables. Yes, country_id
is in both tables. OK, you could have a FK relationship. Or you could simply make sure you insert into Countries
whenever you come across a new country
.
add a comment |
Huh? Sounds like the textbooks are making things too complicated, with too much terminology.
Yes, "country" involves a many:1 relationship. Yes there are 2 tables. Yes, country_id
is in both tables. OK, you could have a FK relationship. Or you could simply make sure you insert into Countries
whenever you come across a new country
.
add a comment |
Huh? Sounds like the textbooks are making things too complicated, with too much terminology.
Yes, "country" involves a many:1 relationship. Yes there are 2 tables. Yes, country_id
is in both tables. OK, you could have a FK relationship. Or you could simply make sure you insert into Countries
whenever you come across a new country
.
Huh? Sounds like the textbooks are making things too complicated, with too much terminology.
Yes, "country" involves a many:1 relationship. Yes there are 2 tables. Yes, country_id
is in both tables. OK, you could have a FK relationship. Or you could simply make sure you insert into Countries
whenever you come across a new country
.
answered Aug 7 '15 at 4:25
Rick JamesRick James
43.7k22259
43.7k22259
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f109270%2fupdating-inverse-side-bidirectional-association%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown