What is a schema manager in Spring's Hibernate and how I set it?

Viewed 131

Some tables were dropped at development environment during a spring-data-jpa project test and the developer responsible for it said it only used spring.jpa.hibernate.ddl-auto=update. Checking here, I suspected he had it set as create-drop, but since he said he didn't use, I went for this piece of information:

Spring Boot chooses a default value for you based on whether it thinks your database is embedded. It defaults to create-drop if no schema manager has been detected

Since his application actually managed to connect to our development environment PostgreSQL database (since it dropped some tables), I start to think he maybe could have forgotten to set hbm2ddl.auto and automatically it went as create-drop.

Is it possible to connect to PostgreSQL and don't have a valid schema manager defined? Which are the most common schema managers?

PS: at this application @DataSource is set this way:

@Bean
public DataSource dataSource() {
    Class.forName("org.postgresql.Driver");
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setUrl(someUrlConnectionStringFromApplicationDotPropertiesFile);
    return dataSource;
}

like String someUrlConnectionStringFromApplicationDotPropertiesFile = "jdbc:postgresql://ipAddress:port/dbName?user=user&password=pass". I know spring-data-jpa sets everything with spring jpa properties automatically without this method, this is currently an unchangeable legacy code :(

0 Answers
Related