User Entity
The User entity represents a library system user. Users can have a collection of books through a many-to-many relationship.User Fields
Unique identifier for the user. Automatically generated using
@PrePersist if not provided.The username for the user’s account.
The full name of the user.
The date of birth of the user in ISO 8601 format (YYYY-MM-DD).
A list of books associated with the user. This is a many-to-many relationship managed by the
user_books join table.UUID Generation
The User 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 Book: Users can have multiple books in their collection, and books can belong to multiple users. The relationship is managed by the
user_booksjoin table with the following structure:user_id: Foreign key to the User entitybook_id: Foreign key to the Book entity
EAGER fetch type and supports PERSIST and MERGE cascade operations.
UserRequest
Data Transfer Object used for creating or updating a user.Request Fields
The username for the user’s account.
The full name of the user.
The date of birth of the user in ISO 8601 format (YYYY-MM-DD).
A list of UUIDs representing the books to be associated with the user.
Example Request
UserResponse
Data Transfer Object returned when retrieving user information.Response Fields
Unique identifier of the user.
The username for the user’s account.
The full name of the user.
The date of birth of the user in ISO 8601 format (YYYY-MM-DD).
A list of UUIDs representing the books associated with the user.