In spring data jdbc bundled with spring boot 3.0.5 I could generate an Id by using the BeforeConvertCallback:
@Configuration
@EnableJdbcRepositories
class JdbcConfig extends AbstractJdbcConfiguration {
@Bean
BeforeConvertCallback<MyEntity> beforeSaveCallback() {
return (entity) -> {
if (entity.getId() == null) {
entity.setId(UUID.randomUUID().toString());
}
return entity;
};
}
With 3.0.6 I get now an SQL error ('ERROR: null value in column "id" of relation'), that the Id is missing, therefore I assume that the BeforeConvertCallback is not longer called.
I went through all versions >= 3.0.6 and none of them have the behaviour I expect.