Files
spring-data-examples/jdbc/basics
Jens Schauder 05bc950a46 #351 - Fix and simplify DataAccessStrategy construction.
Removed explicit generation of DefaultDataAccessStrategy since that is now done by default.

Using MyBatisDataAccessStrategy factory for creating an appropriate DataAccessStrategy in the presence of MyBatis.

Removed references to DefaultNamingStrategy since that is now merged into NamingStrategy.
2018-03-28 11:24:03 +02:00
..
2018-02-22 13:41:01 +01:00

== Spring Data JDBC basics


=== SimpleEntityTests

This example demonstrate basic usage of JDBC based repositories.

* The `SimpleEntityTests` demonstrate CRUD operations for an entity without references, just simple properties of various types.

* The `CategoryContext` shows how to configure an application context so that Spring Data JDBC can create repositories.

* The `ApplicationListener` registered in `CategoryContext` demonstrate how to react to events published by Spring Data JDBC and how entities can get manipulated in such event listeners.

=== AggregateTests

This example demonstrates various ways to bend what the standard mapping of Spring Data JDBC can do.

* `AggregateContext.idSetting()` registers an `ApplicationListener` to implement a custom id generation strategy for `LegoSet` and `Manual`.

* `AggregateContext.namingStrategy()` registers a custom `NamingStrategy` in order to map property and class names to database columns and tables.

* The `minimumAge` and `maximumAge` properties show a way to use types which don't have direct mapping to a SQL type, by marking them with `@Transient` and having converted properties for Spring Data JDBC to use.

* The `models` attribute demonstrate mapping of a `Map<simple type, entity>`. It does work out of the box, but in this case the the key of the map should be one attribute of the entity.
This is achieved by providing a custom `NamingStrategy` which maps both to the same database column.

* When the database returns a data type for query which Spring Data JDBC doesn't map out of the box a custom conversion can be registered using a `ConversionCustomizer` as demonstrated in `AggregateContext.conversionCustomizer()`.