I am looking for some clarification on when to use the aforementioned relationships.
As an example i have a class A which is referenced by instances of class B.
Should this relationship be modelled OneToMany and have a collection of class B defined in class A or be modelled by ManyToOne and have a reference to class A in class B?
My question is whether the choice of relationship is entirely up to the programmer, or application dependent or JPA dependent?
OneToMany and ManyToOne are two sides of the same coin. If the association is unidirectional (that is, it’s not bidirectional) then the choice of relationship is the same as choosing which side owns the relationship. Examples:
If the association is bidirectional then, by assumption, you’re using both OneToMany and ManyToOne. Choosing the owner side does not force you to make an either-or decision.
More reading @ The Java EE 6 Tutorial: Entities.