Which ORM specification ?

There are 2 prevalent specification in the Java ORM world. JDO provides the most complete definition, whilst JPA is the most recent.

Relationships

In this guide we show the different types of ORM relation commonly used, and mark against it which specification supports it. This list is not yet complete but will be added to to provide a comprehensive list of relationship type and where you can find it.

Field Type Relation JDO JPA

PC

1-1 Unidirectional

PC

1-1 Bidirectional

PC

1-1 serialised

PC

1-1 CompoundIdentity Unidirectional

PC

1-N CompoundIdentity Collection Bidirectional

PC

1-N CompoundIdentity Map Bidirectional

Interface

1-1 Unidirectional

Interface

1-1 Bidirectional

Interface

1-1serialised

?

Collection<PC>

1-N ForeignKey Unidirectional Collection

Collection<PC>

1-N ForeignKey Bidirectional Collection

Collection<PC>

1-N JoinTable Unidirectional Collection

Collection<PC>

1-N JoinTable Bidirectional Collection

Collection<Non-PC>

1-N JoinTable Collection

Collection<PC>

1-N JoinTable Collection using shared JoinTable

Collection<PC>

1-N ForeignKey Collection using shared ForeignKey

Collection<PC>

M-N JoinTable

Collection<PC>

1-N CompoundIdentity Unidirectional

Collection<PC>

1-N serialised Collection

Collection<PC>

1-N JoinTable Collection of serialised elements

List<PC>

1-N ForeignKey Unidirectional Indexed List

List<PC>

1-N ForeignKey Bidirectional Indexed List

List<PC>

1-N JoinTable Unidirectional Indexed List

List<PC>

1-N JoinTable Bidirectional Indexed List

List<Non-PC>

1-N JoinTable Indexed List

List<PC>

1-N ForeignKey Unidirectional Ordered List

List<PC>

1-N ForeignKey Bidirectional Ordered List

List<PC>

1-N JoinTable Unidirectional Ordered List

List<PC>

1-N JoinTable Bidirectional Ordered List

Map<PC, PC>

1-N JoinTable Map

Map<Non-PC, PC>

1-N JoinTable Map

Map<PC, Non-PC>

1-N JoinTable Map

Map<Non-PC, Non-PC>

1-N JoinTable Map

Map<Non-PC, PC>

1-N ForeignKey Map Unidirectional (key stored in value)

Map<Non-PC, PC>

1-N ForeignKey Map Bidirectional (key stored in value)

Map<PC, Non-PC>

1-N ForeignKey Map Unidirectional (value stored in key)

Map<PC, PC>

1-N serialised Map

Map<PC, PC>

1-N JoinTable Map of serialised keys/values

PC[ ]

1-N ForeignKey Unidirectional Array

PC[ ]

1-N JoinTable Unidirectional Array

PC[ ]

1-N serialised Array

Non-PC[ ]

1-N JoinTable Unidirectional Array