Package ejava.examples.orm.rel.annotated
Class Media
- java.lang.Object
-
- ejava.examples.orm.rel.annotated.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.
-
-
Constructor Summary
Constructors Constructor Description Media()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Author>
getAuthors()
long
getId()
String
getTitle()
private String
myInstance()
void
setAuthors(Collection<Author> authors)
void
setTitle(String title)
String
toString()
-
-
-
Field Detail
-
id
private long id
-
title
private String title
-
authors
private Collection<Author> authors
-
-
Method Detail
-
getId
public long getId()
-
getTitle
public String getTitle()
-
setTitle
public void setTitle(String title)
-
getAuthors
public Collection<Author> getAuthors()
-
setAuthors
public void setAuthors(Collection<Author> authors)
-
myInstance
private String myInstance()
-
-