From 0d86b134851fffc72e9a8de5bc40456f0cce35b6 Mon Sep 17 00:00:00 2001 From: Evgeni Dimitrov Date: Tue, 8 Jan 2019 22:27:06 +0200 Subject: [PATCH] issue/DATAJDBC-287 - document the possibility to register custom jdbc converters --- src/main/asciidoc/jdbc.adoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/asciidoc/jdbc.adoc b/src/main/asciidoc/jdbc.adoc index 92c2539bfd..a6bfee09e6 100644 --- a/src/main/asciidoc/jdbc.adoc +++ b/src/main/asciidoc/jdbc.adoc @@ -145,6 +145,27 @@ This also means references are 1-1 or 1-n, but not n-1 or n-m. If you have n-1 or n-m references, you are, by definition, dealing with two separate aggregates. References between those should be encoded as simple `id` values, which should map properly with Spring Data JDBC. +=== Custom converters +Custom coverters can be registered, for types that are not supported by default, by inheriting your configuration from `JdbcConfiguration` and overwriting the method `jdbcCustomConversions()`. +==== +[source, java] +---- +@Configuration +public class DataJdbcConfiguration extends JdbcConfiguration { + @Override + protected JdbcCustomConversions jdbcCustomConversions() { + return new JdbcCustomConversions(Arrays.asList(new Converter() { + @Override + public Date convert(TIMESTAMPTZ source) { + //... + } + })); + } +} +---- +==== +The constructor of `JdbcCustomConversions` accepts a list of `org.springframework.core.convert.converter.Converter`. + [[jdbc.entity-persistence.naming-strategy]] === `NamingStrategy`