This is a web application for managing a library, including inventory management (listing available books and the number of copies of each book), handling loans, and managing library staff and members.
- Java
- JakartaEE
- JPA
- MySQL
- Bootstrap
Note
Glassfish server is required to run this project
Database schema is dynamically generated based on the Java Persistence API (JPA) annotations in entities.
Any change whithin the database schema can be managed by editing persistence.xml
file
(/resources/META-INF/persistence.xml
).
<persistence-unit name="db_name">
<class>com.biblioteca.model.entidades.Libro</class>
<class>com.biblioteca.model.entidades.Autor</class>
<class>com.biblioteca.model.entidades.Genero</class>
<class>com.biblioteca.model.entidades.Usuario</class>
<class>com.biblioteca.model.entidades.Prestamo</class>
<properties>
<property name="jakarta.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver"/>
<property name="jakarta.persistence.jdbc.url" value="jdbc:mariadb://localhost:3306/db_name"/>
<property name="jakarta.persistence.jdbc.user" value="user"/>
<property name="jakarta.persistence.jdbc.password" value="password"/>
<property name="jakarta.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
</properties>
</persistence-unit>
Admin users can perform CRUD operations on all entities (books, authors, genres, and users).
Only an admin can make an employee an admin too, and vice versa.
Admins can change authors and genres, as well as upload another book cover.
A modal window is displayed to see the books that belong to each author
A modal window is displayed to see the books categorized with that genre
Admin users have all information about loans at a glance. They can also see the members who have overdue return dates and send them an email to warn. They can also search by both books and members.
Employees are responsible for making loans. They can select members and assign them a book (if they are not banned) Members get banned if they return the book late, and they will not be displayed in the list.
When a loan is made a nice card with all the information appears
Members can check in their profiles the books they have borrowed and whether they returned them on time or not (got banned)
This app also provides a REST API with two endpoints:
Method | URL | Action |
---|---|---|
GET | /api/libros | retrieve all books |
GET | /api/libros/id | retrieve a book by id |