@ManyToOne and @OneToMany Java Annotations

The Many-to-One link is the foundation of persistent relations. @ManyToOne relation links a source table to a destination with a database REFERENCES column.
Many-to-One adds two capabilities: SQL extensions for links and direct lookup of target beans through field references.

The @OneToMany relation adds collection extensions to the query language and provides a Java Collection containing the children.
@OneToMany represents a collection of children belonging to a parent, like students in Gryffindor house at Hogwarts school.

A Many-to-One relation links one source entity to another target entity. A one-to-many relation links the target entity back to the source entity.

Continue reading