Skip to content

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

Albert edited this page Jun 3, 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

  • n:m with 1:n and n:1, with @Entity borrow

  • getUUID, spring doc

  • Audit, as a Abstract class, example

  • Inherence, Inheritance for a JPA Entity and Interface

      @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{
    
        private long bookItemId;
        private boolean isLost;
       // constructor, getters, setters 
      }
    
  • JPQL : Java Persistence/JPQL

  • DTO, Data Transfer Object :

  • Create QR

  • 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

Clone this wiki locally