0% found this document useful (0 votes)
36 views

Assosiation in Hibernate

This document outlines the different Hibernate association mappings including @OneToOne, @OneToMany, @ManyToOne, and @ManyToMany. It specifies that for uni-directional mappings the parent class needs a reference to the child, while for bi-directional both the parent and child need references to each other. For collections, the parent needs a collection property of the child type and the child needs a reference to the parent.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Assosiation in Hibernate

This document outlines the different Hibernate association mappings including @OneToOne, @OneToMany, @ManyToOne, and @ManyToMany. It specifies that for uni-directional mappings the parent class needs a reference to the child, while for bi-directional both the parent and child need references to each other. For collections, the parent needs a collection property of the child type and the child needs a reference to the parent.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Hibernate Association mapping

Assosiation @OneToOne @OneToMany @ManyToOne @ManyToMany


way
Uni directional Parent/Child class Parent class Child class should Parent class
should have should have Child have Parent class should have Child
Child/Parent class class collection reference type class collection
reference type type property property type property
property AND
Child class should
have Parent class
collection type
property
Bi directional Parent class Parent class Parent class
should have Child should have Child should have Child
class reference class collection class collection
type property type property type property
AND AND AND
Child class should Child class should Child class should
have Parent class have Parent class have Parent class
reference type reference type reference type
property property property

You might also like