org.springframework.data.jdbc.core.convert.JdbcCustomConversions Java Examples

The following examples show how to use org.springframework.data.jdbc.core.convert.JdbcCustomConversions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AggregateConfiguration.java    From spring-data-examples with Apache License 2.0 6 votes vote down vote up
@Override
public JdbcCustomConversions jdbcCustomConversions() {

	return new JdbcCustomConversions(asList(new Converter<Clob, String>() {

		@Nullable
		@Override
		public String convert(Clob clob) {

			try {

				return Math.toIntExact(clob.length()) == 0 //
						? "" //
						: clob.getSubString(1, Math.toIntExact(clob.length()));

			} catch (SQLException e) {
				throw new IllegalStateException("Failed to convert CLOB to String.", e);
			}
		}
	}));
}
 
Example #2
Source File: ConverterConfiguration.java    From code-examples with MIT License 5 votes vote down vote up
@Override
public JdbcCustomConversions jdbcCustomConversions() {
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");
  return new JdbcCustomConversions(Arrays.asList(
      new UserIdReadingConverter(),
      new UserIdWritingConverter()
  ));
}
 
Example #3
Source File: JdbcConfig.java    From platform with Apache License 2.0 5 votes vote down vote up
@Bean
public JdbcCustomConversions jdbcCustomConversions() {
    return new JdbcCustomConversions(Arrays.asList(
            new IntegerToBooleanConverter(),
            new BooleanToIntegerConverter())
    );
}