Software Development, Linux, and Windows

Notes on Software Development, Linux, and Windows

SpringBoot

Options for spring.jpa.hibernate.ddl-auto

validate: validate the schema, makes no changes to the database. update: update the schema. create: creates the schema, destroying previous data. create-drop: drop the schema when the SessionFactory is closed explicitly, typically when the application is stopped.

Posted in Hibernate, JPA, Spring, SpringBoot | Comments Off

Configure SpringBoot with H2 Database

Prerequisite: Go to start.spring.io and create a new SpringBoot project with Web, H2, and DevTools for dependencies. Import new project into STS (Spring Tools Suite). Additions to application.properties: Open /src/main/resources/application.properties and add the following lines: # H2 spring.h2.console.enabled=true spring.h2.console.path=/h2 # Datasource spring.datasource.url=jdbc:h2:file:~/test spring.datasource.username=sa spring.datasource.password= spring.datasource.driver-class-name=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=validate spring.jpa.show-sql=true NOTE: If you want your database [...]

Posted in h2, Hibernate, JPA, SpringBoot | Comments Off