Spring H2 Support: Difference between revisions
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
* [[Spring_Data#Supported_SQL_Databases|Spring Data]] | * [[Spring_Data#Supported_SQL_Databases|Spring Data]] | ||
* [[H2]] | * [[H2]] | ||
=Playground Example= | |||
{{External|[https://github.com/ovidiuf/playground/tree/master/spring/jpa/h2 Playground Spring Data H2 JPA]}} | |||
=Overview= | =Overview= |
Revision as of 17:23, 31 October 2018
Internal
Playground Example
Overview
Dependencies
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
runtimeOnly('com.h2database:h2')
}
Spring Configuration
Add in application.properties or equivalent:
spring.datasource.url=jdbc:h2:tcp://localhost/mem:default
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.platform=h2
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true