Hibernate in Spring Boot – Quick Start
Set up dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> Configuring JPA and Hibernate in application.properties file spring.datasource.url=jdbc:mysql://localhost:3306/dbname spring.datasource.username=root spring.datasource.password=password spring.jpa.hibernate.ddl-auto=update or application.yml spring: application: name: demoapp datasource: url: jdbc:mysql://localhost:3306/dbname username: root password: password driver-class-name: com.mysql.cj.jdbc.Driver jpa: hibernate: ddl-auto: update show-sql: true open-in-view: false More config (optional) import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; Read more…