Reputation: 23492
I'm developing a Spring Boot application using an embedded HSQLDB for local deployment. I defined the bean as follows
@Bean
public DataSource ds() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.HSQL)
.addScript("classpath:db/schema.sql")
.addScript("classpath:db/data.sql")
.build();
}
However, when I try to fetch all the entities from the database with JPA, I get an empty result.
I would like to execute query against the embedded database at runtime to see the actual data. What port/protocol the HSQLDB listens to, and what client I need to connect and execute query?
Upvotes: 1
Views: 148
Reputation: 23492
The solution was to add following properties to application.properties
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=validate
This is because the default strategy for hibernate is to drop and re-create the the database schema for the entities it manages, which negated my database scripts.
Upvotes: 1