Just learned the integration of Hibernate and spring, and now it's time to summarize.
To implement a function as an example, share the whole process with you.
What you need to do: build a person class that includes name,sex,age,birthaday four properties that we want to implement to add a person object to the database through Hibernate and spring.
Here's the whole process:
1. Create a new Java project and rewind the package (including SPRING,HIBERNATE,JDBC,C3P0, etc.)
2. Add the external C3P0 connection pool configuration file
3. Preparation of entity classes and their mapping files and hibernate configuration files
Configuration file Preparation for 4.spring
The spring configuration file is roughly divided into 4 parts: injection of the connection pool data source, session factory injection, bean injection, declaration of the transaction
5. Background code
DAO and Service Interface code:
DAO and Service implementation class code
Test code
The integration of Hibernate and Spring