spring - JPA and database interaction -


i quite new spring , jpa environment. wrote small code stores information of offices using repository.save(office object) operation. when rerun code shows there no such entry (that entered before). how can permanently store information in database using jpa?

if use h2 without configuration (only dependency in gradle/maven), spring create inmemory db you. change setting can create own datasource bean. there simpler way if use spring boot - configure in application.properties.

spring.datasource.url=jdbc:h2:file:<path to store url>;db_close_delay=-1;db_close_on_exit=false spring.datasource.driverclassname=org.h2.driver spring.datasource.username=sa spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.h2dialect spring.jpa.hibernate.ddl-auto=update 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -