Trying this again but with a slightly different approach. My previous thread was here Can anyone explain this one-to-one, one-to-many, many-to-one, many-to-many concept with respect to ORMs? but honestly I think it confused me more than it helped, especially when there seemed to be conflicting views even among the answers / commenters.I'm not sure if my understanding is correct and I just lacked the vocabulary to express it, or if I have a serious hole somewhere that needs to be resolved with an explicit counter-example.So I want to try this again with a more explicit example or two. Example 1:Let's say I defined two classes like so:class A {     private String name;    private List<B> listB;}class B {    private String name;}Now in this example I have not said anything explicitly (in terms of annotations) about whether the relationships are one to one, one to many in either direction, or many to many. I am going solely from the cardinalities of the containers.To my understanding, this is a one to many relationship from A to B and the ORM would map this like so:Example 2:Let's say I defined two classes like so:class A {     private String name;    private List<B> listB;}class B {    private String name;    private A referenceA;}I assume that this ends up with the same table mapping as Example 1.Example 3:Let's say I defined two classes like so:class A {     private String name;    private List<B> listB;}class B {    private String name;    private List<A> listA;}I assume this is a many-to-many relationship, and an ORM would map it like this:My question is whether or not my understanding is correct and whether or not this sort of approach results in any ambiguities (and what an example of that might look like).
Labeling the multiplicities in class-table mappings
java;design;sql;orm;relational database