Skip to content

Library4: API Rest Library Book Author @ManyToMany @OneToMany CRUD with Swagger and Inherence

Albert edited this page Jun 9, 2022 · 20 revisions

Welcome to the cifojava2022-3 wiki!

Spring Boot Projects: Library4

Base project

  • Base project:
    • POM
    • 1:n relationship: unidrectional or bidirectional
      • @Entity book and List<Book>
      • Author @Entity
    • 1:1 relationship
      • library and address @Entity
    • n:m @Entity book and library
    • Annotations:
      • @OneToMany
      • @ManyToMany
      • @JoinColumn
      • @OneToOne
      • @ManyToMany
      • @JoinTable
    • Swagger: URL swagger : http://localhost:8080/swagger-ui.html
    • JUnit Jupiter to test
    • DataBase H2: Library4
      • First-time CREATE DDL : First-time CREATE DDL option (after that UPDATE) in application.properties
      • Application.properties
      • Command Line Runner with methods to test and JavaFaker
      • @Service, @CrudRepository JPA 2.0, @Component

New tools

  • Define a n:m relationship with:

    • @Entity borrow
      • book 1:n borrow n:1 user
    • Tools per class
    • Inherence:
      • Inherence, Inheritance for a JPA Entity and Interface

      • Study inherence and JPA repository cifojava2022-6

         @MappedSuperclass
         //not @Entity
         public class Book{
        
            @Id
            //private long bookId;
            private UUid bookId;
            private String title;
            // constructor, getters, setters
          }
        
        
          @Entity
          public class BookItem extends Book{
          @Id
          private long bookItemId;
          private boolean isLost;
          // constructor, getters, setters 
          }
        
  • UML back-end, done by draw.io

    • Tentative draft-UML to study and to start working:

      UML

Versions

  • version 1.0 : basic project from library2 and library3
    • Tree project

      UML

    • version 1.1 : basic project from library2 and library3 with ddd, domians

Clone this wiki locally