Class Media


  • @Entity
    public class Media
    extends Object
    This class represents a media topic, for which there are many copies and authors. There are also many media in an Inventory

    It is an example of a ManyToOne uni-directional relationship. There are zero to many MediaCopy(s) for each Media. However, there is no reference to the copies from Media. All access to the copies must come through querying the MediaCopies. MediaCopy happens to both "own" the relationship and be the only that it can be navigated by (uni-directional).

    It is also an example of a OneToMany uni-directional relationship using a Join (or Link) table. There are zero to many Media in Inventory. However, there is no reference to the Inventory from this class or MEDIA table. The linkage is done through a separate table defined in the Inventory class. Inventory both "owns" the relationship and is the only side that it can be navigated by. It is also an example of ManyToMany bi-directional relationship. Each Media can have zero to many Authors. Each Author can have zero to many Media. Author "owns" the relationship (thus defines the join/link table). Media only defines the mapping back to Author. The relationship can be navigated by either side.