Spring Boot + IntelliJ + Embedded Database = Headache

前端 未结 5 1791
执笔经年
执笔经年 2020-12-29 05:05

Either I\'m missing some core concept buried deep within some documentation (Spring, Spring Boot, H2, HSQLDB, Derby, IntelliJ) or I\'ve been staring at this for too long.

5条回答
  •  清酒与你
    2020-12-29 06:06

    I had similar problem. It was due to the default create-drop ddl strategy of the hibernate. With this strategy after the application shutdown hibernate destroys the schema at the end of the session, that's why IntelliJ don't show anything. Change ddl strategy to the create and hibernate will create the schema and destroy previous data on the next application startup.

    Here is an example of my configuration:

    application.yml

    spring:
      datasource.url: jdbc:h2:./db/testDb
      jpa.hibernate.ddl-auto: create
    

    IntelliJ database properties

    Result

提交回复
热议问题