Book Entity
The Book entity represents a book in the library system. Books can be associated with multiple users through a many-to-many relationship.Book Fields
Unique identifier for the book. Automatically generated using
@PrePersist if not provided.The genre of the book (e.g., “Fiction”, “Science”, “History”).
The author’s name.
URL or path to the book’s cover image.
The main title of the book.
The subtitle of the book.
The name of the publisher.
The publication year of the book.
The number of pages in the book.
The International Standard Book Number (ISBN) for the book.
A list of users who have this book in their collection. This is a many-to-many relationship mapped by the “books” field in the User entity.
UUID Generation
The Book entity uses the@PrePersist callback to automatically generate a UUID for the id field if one is not already set:
Relationships
- Many-to-Many with User: Books can be associated with multiple users, and users can have multiple books. The relationship is managed by the
user_booksjoin table.
BookRequest
Data Transfer Object used for creating or updating a book.Request Fields
The genre of the book.
The author’s name.
URL or path to the book’s cover image.
The main title of the book.
The subtitle of the book.
The name of the publisher.
The publication year of the book.
The number of pages in the book.
The International Standard Book Number (ISBN) for the book.
Example Request
BookResponse
Data Transfer Object returned when retrieving book information.Response Fields
Unique identifier of the book.
The genre of the book.
The author’s name.
URL or path to the book’s cover image.
The main title of the book.
The subtitle of the book.
The name of the publisher.
The publication year of the book.
The number of pages in the book.
The International Standard Book Number (ISBN) for the book.