Jpa is a java framework to manage relational database records as plain java objects.
It can be confirured (if you are using [[maven]] and spring boot) in the pom file, with the following dependencies:
org.springframework.boot
spring-boot-starter-data-jpa
And you will need to specify a database, for example:
mysql
mysql-connector-java
runtime
Or
com.h2database
h2
runtime
In addition, you have to configure some properties, that can be done in the properties file or by java code. In the property file would be:
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
#spring.jpa.properties.hibernate.default_schema=sql7351295
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.generate_statistics=true
#to generate the tables, fields and other ddl structures if they are not present
spring.jpa.hibernate.ddl-auto=update
#to transform the hql queries in sql to be seen in the logfile
spring.jpa.show-sql=true
#to use a h2 in memmory embedded database
spring.datasource.url=jdbc:h2:mem:testdb
#to use a h2 file database
#spring.datasource.url=jdbc:h2:file:/data/demo
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect