Using Spring Boot, JPA, Hibernate Bidirectional Mapping Part 3 | CodeWithNaval

Опубликовано: 06 Октябрь 2025
на канале: CodeWithNaval
2,740
45

In this tutorial we will build CRUD Operation Using Spring Boot, MySQL, JPA, Hibernate.
We will create RESTful APIs and then we test those APIs using Postman.

I have provide project in GitHub you can check on that.



GitHub Link:- https://github.com/NavalchandMaher/Co...


guys I thing you learn something from this video. if you like and watch more video then LIKE, SHARE and SUBSCRIBE my Channel and become part of this Channel







Unidirectional :
-No Need To Define Mapping In Child Entity Classes.
-Only Parent Table Know About Mapping.


Bidirectional:-
-In Parent Entity Class And Child Entity Class Both Side
Define Mapping .

ex. Parent -- OneToMany
Child -- ManyToOne .


Mapping Type:-


1) @OneToOne
One Parent Should Only One Child
Child Also Have only one Parent
2) @ManyToOne
-Many Parent Have One Child.
One Child Have Many Parent.
3) @OneToMany
--One Parent Have Many Child.
Many Child Have One Parent.
4) @ManyToMany
Many Parent Have Mane Child.


Cascade Types in Hibernate
Cascading is a phenomenon involving one object propagating to other objects via a relationship. It is transitive in nature and the cascade attribute in hibernate defines the relationship between the entities. The cascading types supported by the hibernate framework are as follow:

CascadeType.PERSIST: It means that the save() and persist() operations in the hibernate cascade to the related entities
CascadeType.MERGE: It means that the related entities are joined when the owning entity is joined
CascadeType.REMOVE: It means that the related entities are deleted when the owning entity is deleted
CascadeType.DETACH: It detaches all the related entities if a manual detach occurs
CascadeType.REFRESH: It works similar to the refresh() operation in the hibernate
CascadeType.ALL: It is an alternative for performing all the above cascade operations in the hibernate framework



All Video Link

Channel Link:-   / @codewithnaval  


Spring boot with MySql CRUD :-   • Using Spring Boot+MySQL+JPA+Hibernate Rest...  

Lombok install in eclipse and STS :-   • Install Lombok In Your "Eclipse/STS" Use (...  

Download and Install STS Any OLD and New Version :-   • Download  STS Old Version [3.9.12 , 2.0.1 ...