Spring Applications
Exercise: Book Entity
The objective of this exercise is to implement a book entity and a repository with CRUD operations.
- Create and start a PostgreSQL database
bookstore
.
- Implement a
Book
class and add JPA annotations to make it an entity class that conforms to the given SQL schema.
- Implement a
BookRepository
class that creates an entity manager and implements CRUD operations for the Book
entity.
- Place the configuration file persistence.xml, which defines the persistence unit
bookstore
connected to the PostgreSQL database, in the resources/META-INF
folder.
- Add the SQL script data.sql, which initializes the database with test data, to the same folder and run the BookRepositoryIT integration test.