-
Demonstrate explicit projection declaration
-
Demonstrate projection customizations
-
Demonstrate custom JSON deserialization/serialization for a projection field
-
Demonstrate maintenance to/from a synthetic map to a different JPA domain structure
-
Builds On : 01600-newDomainComplexField, 00300-productExtensionExplicitProjection
-
Create spring boot autoconfiguration class
NewDomainExplicitProjection
, which will be referenced from META-INF/spring.factories -
Setup domain (see 1600-newDomainComplexField)
-
Additionally, make
ChargingStation
implementsBusinessTypeAware
andModelMapperMappable
-
Create a projection class (
ChargingStationProjection
) -
Implement
getBusinessDomainType()
inChargingStation
and returnChargingStationProjection
as the type -
Implement toMe/fromMe in
ChargingStation
(from ModelMapperMappable contract)-
ModelMapper will automatically map similar fields
-
For unusual mappings, use a post converter
-
Create a ModelMapper type map for your repository domain and projection and register your post converter
-
-
Declare
@EnableJpaTrackableFlow
on the autoconfiguration class to setup the lifecycle plumbing for the new domain class -
Declare
@AutoConfigureBefore
on the autoconfiguration class to scan the new domain class before JPA processing