-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL initialization with "data.sql" comes too late if using hibernate DDL auto as well #1006
Comments
So what did we do wrong? Is the Hibernate property name fat-fingered? |
No I did not override hibernate.properties The configuration looks like this: import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main (String[] args) {
SpringApplication.run(Application.class);
}
} Hibernate part in1.0.2.RELEASE:
Hibernate part in 1.1.0.M2:
Does it mean that new default for |
It says |
Sorry I copied incorrectly from clipboard updated comment. |
The The problem seems to be that @mihkels can you post your sample app somewhere? Or at least check how it differs with @dsyer, thoughts? |
The hbm2ddl.auto message is a warning only, so I think it's irrelevant (there is some evidence on the internet of other people using it as an undocumented safe way to switch off the ddl features). Also as Andy pointed out it's there in both logs. The ordering of the initialization a changed in 1.1 to accommodate liquibase running before hibernate. The same argument applies to the native Boot initialization via schema.sql (and data.sql). So I guess the problem here is that you are relying on the hibernate initialization happening before the SQL scripts are executed. That's probably not a good idea anyway because you won't want them to run at all in production, but we can have a look at your use case and see if we can make it work more naturally. I am surprised the JPA sample isn't exactly the same though. If you look at |
The difference with the Boot JPA sample is that it uses "import.sql" (Hibernate feature) not "data.sql" (Spring Boot feature). |
This warning isn't present in boot 1 ... My guess a new version of Hibernate introduced with that prop value removed. |
Looks like we are adding "none" here: Perhaps we should just omit |
It's just a warning. Can we ignore it and focus on the real issue here? |
Raised #1012 for the warning issue. Is this one a blocker for RC1? |
I don't think it's a blocker: you can just use "import.sql" if you're using JPA. |
I wouldn't qualify it as a blocker but it's a serious regression. The spring boot feature ( |
Added 2 new spring.datasource.* properties ("data" like "schema", and "deferDdl" like the "spring.jpa.hibernate.*" flag). The SQL scripts are then run separately and the "data" ones are triggered by a new DataSourceInitializedEvent, which is also published by the Hibernate DDL schema export. Fixes spring-projectsgh-1006
JVM:
Spring Boot:
Spring Boot 1.1.0.M2 fails to create HSQLDB in memory database tables and in boot up log there are these line:
For that reason loading in data from
data.sql
fails with following exception:Tested also with version 1.0.2.RELEASE and everything works as expected tables are created and
data.sql
is loaded in without any issues.The text was updated successfully, but these errors were encountered: