Open frolovgo opened 3 years ago
Hi @frolovgo
I did not experiment with that myself, but I do recall that some of the tricky stuff with this was getting the InitializeEnumBackedTables
hooked into spring at the right point of bootstrapping.
I think that the later versions of spring boot have reworked this logic a bit, try digging into https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.data-initialization.
Best regards Jens
Hello @djarnis73, is it possible to use this solution with data-initialisation from *.sql-files(to populate related tables)? For example, I have added "spring.datasource.data=classpath:data.sql" to application.properties and add data.sql with this string:
insert into product(new_style_color_id) values(1); --Referential integrity constraint violation during application startup
I have added something like this to InitializeEnumBackedTables.initializeEnumTables (and moved problem SQL to additionalData.sql)
to work around the issue. But maybe there is more elegant solution ?