DEV Community

Code Green for CodeGreen

Posted on • Updated on

what is JPA? explain few configurations

JPA in Spring

=============

JPA (Java Persistence API) in Spring simplifies database interactions by providing a standard way to map Java objects to database tables and vice versa.

Common Configurations for JPA

spring.datasource

This configuration specifies the database connection details.

spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa

These properties configure the behavior of JPA.

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

Purpose

spring.datasource is used to specify the database connection details, while spring.jpa configures JPA-related behavior such as SQL dialect and DDL auto-generation.


Discover the more Java interview question for experienced developers! YouTube Channel Link

Top comments (0)