Skip to content

Document the usage of JdbcConfiguration [DATAJDBC-287] #512

@spring-projects-issues

Description

@spring-projects-issues

Evgeni Dimitrov opened DATAJDBC-287 and commented

Please document the possibility to configure customer converters by overriding JdbcConfiguration. 

 Reason/source for the task: https://stackoverflow.com/questions/53120420/does-spring-data-jdbc-support-custom-type-converters

Example related to my question:

@Configuration
public class DataJdbcConfiguration extends JdbcConfiguration { 

@Override 
protected JdbcCustomConversions jdbcCustomConversions() { 
    return new JdbcCustomConversions(
         Arrays.asList(new Converter<TIMESTAMPTZ, Date>() {
              @Override public Date convert(TIMESTAMPTZ source) { 
                    try { 
                         return source.dateValue(); 
                    } catch (SQLException e) { 
                         throw new CustomConverterException(); 
                    } 
              } 
         })); 
     }
}

Referenced from: pull request #106

Backported to: 1.0.4 (Lovelace SR4)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions