Java Zone - The heart of the Java developer community

Java Zone - The heart of the Java developer community


Introduction to Spring Data JPA Part 8: Many-to-Many Bidirectional

Posted: 17 May 2020 01:16 PM PDT

In this article, we will discuss the following:

  • Many to Many Bidirectional.
  • @JsonIdentityInfo.
  • @JoinTable with JoinColumns and InverseJoins.
  • Bad Effects of CascadeType.ALL, Refactoring the code.
  • Using Model Classes.
  • Replacing Annotations like @JsonIdentityInfo, @JsonManagedReference, @JsonIgnore - Refactoring the code for GET Requests.

Let us start by modeling the entities:
Modeling entitiesYou can see the definition of Role in the User entity and the definition of User in Role entity. Hence, we can call it bidirectional. The requirement is that one User can have many Roles, and one Role can be associated with many Users. Hence, it is a Many-to-Many relationship. Let us see what Hibernate gives us by default.
Hibernate generated relationshipA mapping table with users_id and roles_id. Now, let us look at the entities. 

Introduction to Spring Data JPA Part 7: Unidirectional Many-to-Many Relationships

Posted: 17 May 2020 12:43 PM PDT

We will discuss the following:

  • Unidirectional many-to-many relations.
  • CRUD Operations.

Let us start by modeling the entities.
Loading entitiesLet us see how Hibernate creates the tables for us.
Hibernate creating tablesA mapping table is created.

10 Courses to Learn Spring Boot and Microservices in Java

Posted: 17 May 2020 12:34 PM PDT

Hello guys, if you are interested in learning Spring Boot and looking for some awesome resources like books, tutorials, and online courses to start with then you have come to the right place.

Earlier I have shared some great books to learn Spring Framework, including Spring Boot (see) and today I'll share some of the best online Spring Boot courses you can join to learn Spring Boot by yourself.

Comments

Popular posts from this blog

DZone.com Feed