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

The following examples show how to use org.springframework.data.jdbc.core.convert.JdbcCustomConversions. These examples are extracted from open source projects. 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
@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 Project: code-examples   Source File: ConverterConfiguration.java    License: 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 Project: platform   Source File: JdbcConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JdbcCustomConversions jdbcCustomConversions() {
    return new JdbcCustomConversions(Arrays.asList(
            new IntegerToBooleanConverter(),
            new BooleanToIntegerConverter())
    );
}