diff --git a/src/main/asciidoc/jdbc.adoc b/src/main/asciidoc/jdbc.adoc index eb60da962..1a0356dc5 100644 --- a/src/main/asciidoc/jdbc.adoc +++ b/src/main/asciidoc/jdbc.adoc @@ -127,7 +127,7 @@ The Spring Data JDBC repositories support can be activated by an annotation thro class ApplicationConfig extends AbstractJdbcConfiguration { // <2> @Bean - public DataSource dataSource() { // <3> + DataSource dataSource() { // <3> EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); return builder.setType(EmbeddedDatabaseType.HSQL).build(); @@ -250,13 +250,11 @@ Custom converters can be registered, for types that are not supported by default [source,java] ---- @Configuration -public class DataJdbcConfiguration extends AbstractJdbcConfiguration { +class DataJdbcConfiguration extends AbstractJdbcConfiguration { @Override public JdbcCustomConversions jdbcCustomConversions() { - return new JdbcCustomConversions(Collections.singletonList(TimestampTzToDateConverter.INSTANCE)); - } @ReadingConverter @@ -303,7 +301,7 @@ The following example maps the `MyEntity` class to the `CUSTOM_TABLE_NAME` table [source,java] ---- @Table("CUSTOM_TABLE_NAME") -public class MyEntity { +class MyEntity { @Id Integer id; @@ -322,7 +320,7 @@ The following example maps the `name` property of the `MyEntity` class to the `C ==== [source,java] ---- -public class MyEntity { +class MyEntity { @Id Integer id; @@ -340,7 +338,7 @@ In the following example the corresponding table for the `MySubEntity` class has ==== [source,java] ---- -public class MyEntity { +class MyEntity { @Id Integer id; @@ -348,7 +346,7 @@ public class MyEntity { Set subEntities; } -public class MySubEntity { +class MySubEntity { String name; } ---- @@ -360,7 +358,7 @@ This additional column name may be customized with the `keyColumn` Element of th ==== [source,java] ---- -public class MyEntity { +class MyEntity { @Id Integer id; @@ -368,7 +366,7 @@ public class MyEntity { List name; } -public class MySubEntity { +class MySubEntity { String name; } ---- @@ -388,7 +386,7 @@ Opposite to this behavior `USE_EMPTY` tries to create a new instance using eithe ==== [source,java] ---- -public class MyEntity { +class MyEntity { @Id Integer id; @@ -397,7 +395,7 @@ public class MyEntity { EmbeddedEntity embeddedEntity; } -public class EmbeddedEntity { +class EmbeddedEntity { String name; } ---- @@ -414,7 +412,7 @@ Make use of the shortcuts `@Embedded.Nullable` & `@Embedded.Empty` for `@Embedde [source,java] ---- -public class MyEntity { +class MyEntity { @Id Integer id; @@ -610,7 +608,7 @@ The following example shows how to use `@Query` to declare a query method: ==== [source,java] ---- -public interface UserRepository extends CrudRepository { +interface UserRepository extends CrudRepository { @Query("select firstName, lastName from User u where u.emailAddress = :email") User findByEmailAddress(@Param("email") String email); @@ -828,7 +826,7 @@ For example, the following listener gets invoked before an aggregate gets saved: [source,java] ---- @Bean -public ApplicationListener> loggingSaves() { +ApplicationListener> loggingSaves() { return event -> { @@ -845,7 +843,7 @@ Callback methods will only get invoked for events related to the domain type and ==== [source,java] ---- -public class PersonLoadListener extends AbstractRelationalEventListener { +class PersonLoadListener extends AbstractRelationalEventListener { @Override protected void onAfterLoad(AfterLoadEvent personLoad) { @@ -937,11 +935,11 @@ If you need to tweak transaction configuration for one of the methods declared i ==== [source,java] ---- -public interface UserRepository extends CrudRepository { +interface UserRepository extends CrudRepository { @Override @Transactional(timeout = 10) - public List findAll(); + List findAll(); // Further query method declarations } @@ -959,7 +957,7 @@ The following example shows how to create such a facade: [source,java] ---- @Service -class UserManagementImpl implements UserManagement { +public class UserManagementImpl implements UserManagement { private final UserRepository userRepository; private final RoleRepository roleRepository; @@ -999,7 +997,7 @@ To let your query methods be transactional, use `@Transactional` at the reposito [source,java] ---- @Transactional(readOnly = true) -public interface UserRepository extends CrudRepository { +interface UserRepository extends CrudRepository { List findByLastname(String lastname); @@ -1035,7 +1033,7 @@ In order to activate auditing, add `@EnableJdbcAuditing` to your configuration, class Config { @Bean - public AuditorAware auditorProvider() { + AuditorAware auditorProvider() { return new AuditorAwareImpl(); } }