This is a Java Swing desktop application for managing employee data. It strictly adheres to the Model-View-Controller (MVC) architectural pattern and uses JPA/Hibernate for database interactions with an embedded H2 database.
Employee.java
JPA Entity class, an EmployeeRepository.java
for direct database operations using JPA’s EntityManager
, and an AppModel.java
. The AppModel holds the list of employees and crucially uses PropertyChangeSupport
to notify the view of data changes, implementing the Observer pattern.AppView.java
, the main window with a JTable
to display employees, and InsertView.java
, a dialog for adding/editing records. AppView
registers as a PropertyChangeListener
to the AppModel
to enable automatic UI updates.AppController.java
acts as the mediator. It handles user interactions from the views (button clicks), translates them into model operations (e.g., calling appModel.persist()
), and manages the visibility of the different views.persistence.xml
.