spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
772 stars 346 forks source link

Disable auto-apply custom converts [DATAJDBC-379] #577

Open spring-projects-issues opened 5 years ago

spring-projects-issues commented 5 years ago

James Clark opened DATAJDBC-379 and commented

We should add the ability to disable auto-applied custom converters. I.E. just because a conversion exists, doesn't mean it should be used by default. We should then provide a "@Convert" annotation, similar to the JPA one, that allows columns to specify which converter to use


Issue Links:

1 votes, 1 watchers

spring-projects-issues commented 5 years ago

Jens Schauder commented

Do you have an example where the application of converters causes a problem?

spring-projects-issues commented 5 years ago

James Clark commented

It's not a problem per se, just a nice feature to have. If, for instance, dates were stored as integers in the database, then a converter for integer -> LocalDate would be useful, but you don't want all integers to be converted to LocalDate. 

spring-projects-issues commented 5 years ago

Jens Schauder commented

Thanks for the clarification. That makes sense

spring-projects-issues commented 3 years ago

Mark Paluch commented

Since Spring Data Commons 2.4, you can configure which converters to register (or not register to be more precise) in CustomConversions. Other than that, the topic of property-based converters comes up regularly but we haven’t found a good generic approach yet.