Spring Applications

Exercise: Book Entity

The objective of this exercise is to implement a book entity and a repository with CRUD operations.
  1. Create and start a PostgreSQL database bookstore.
  2. Implement a Book class and add JPA annotations to make it an entity class that conforms to the given SQL schema.
  3. Implement a BookRepository class that creates an entity manager and implements CRUD operations for the Book entity.
  4. In the persistence.xml configuration file define the persistence unit bookstore which maps the Book entity to the bookstore database.
  5. Add the property jakarta.persistence.sql-load-script-source with the value META-INF/data.sql and save the SQL script with the test data in the corresponding folder.
  6. Run the BookRepositoryIT integration test.