posted 2 years ago
Hi, Mason,
Would you mind to post your example code so that we can see what you are working on?
In Spring Data JPA, you can simply create something like this:
Suppose you have a table called Person and the table primary key is an integer.
In your service layer, you can autowire the PersonRepository like this:
In your resources folder, create a data.sql file and put something like this:
In your pom.xml, include the following dependencies. The second one indicate that you want to your embedded H2 database.
If you want to use MySQL database, you may want to include this instead of h2database:
And also specify the url of the MySQL database in application.properties in resources folder: