SpringBoot Section 3: Database Operations (Part 1)

 Spring-Data-Jpa, which defines a series of object persistence standards, is the integration of Hibernate. This section is about the configuration of datasouce and jpa.

 

1. Add 2 dependencies to the pom.xml file:

2. Create a database, dbgirl

3. Configure in the application.yml file

4. Create a new class girl, the tables and fields here are corresponding to the database, and the corresponding annotations are added to generate no-parameter construction and setter/getter methods, as shown below:

5. After the project runs successfully, look at the database, you can see a girl table, which has the attributes mapped by the girl class just now

Configuration details of jpa.hibernate.ddl-auto:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324931793&siteId=291194637