Enterprise Application Project Report

Hibernate is a framework to map object-oriented model into a relational database. In this project, we must state the hibernate version in the pom.xml file and let the maven download the repository. The hibernate then will be combined with the Spring framework in order to acess the database and use the database object to create the database operation of create, read, update, and delete (CRUD).

Then, we need to create the hibernate configuration file in the config folder. In the configuration file, we  imported the org.hibernate.SessionFactory, org.springframework.orm.hibernate4.HibernateTransactionManager, and org.springframework.orm.hibernate4.LocalSessionFactoryBean. All of these packages will be used for defining hibernate configuration. There are four functions for defining the configuration.

sessionFactory() function is the usual way to set up a shared Hibernate SessionFactory in a Spring application context; the SessionFactory can then be passed to Hibernate-based data access objects via dependency injection. dataSource() is used to definie the acess to the MySQL database.  hibernateProperties() is used to define the hibernate properties including dialect, show_sql, and format_sql. And the last one, transactionManager(SessionFactory s), Binds a Hibernate Session from the specified factory to the thread, potentially allowing for one thread-bound Session per factory.

For the database part, we used MySQL database. The database definition is available in the application.properties file. In this file we define the database URL, username, password, and also the hibernate dialect. The database table is define in the model part. In the model file, we define the object with the same properties in the database table field.

For defining the database operation, we define it in the DAO files of each model. This DAO implementation will be acessed by each model services. Later on, the services implementations will also be used when we create the controller to run the operation on each models.

For the edit pages, we pulled the data to the front-end with Angular, using ng-model, ng-checked, etc. This will show the value of the variable in the angular that was pulled from the database.

Leave a Reply

Your email address will not be published. Required fields are marked *