

The following table summarizes the possible alternative patterns, behaviour and expected return types: Table 2. (requires JPA implementation)Įxtends CrudRepository and adds methods for paginationĮxtends GenericRepository and adds methods for asynchronous CRUD executionĮxtends AsyncCrudRepository and adds methods for paginationĮxtends GenericRepository and adds CRUD methods that return PublisherĮxtends ReactiveStreamsCrudRepository and adds methods for paginationĮxtends ReactiveStreamsCrudRepository and is using Reactor return typesĮxtends ReactorCrudRepository and adds methods for paginationĮxtends GenericRepository and adds CRUD methods that return RxJava 2 typesĮxtends GenericRepository and is using Kotlin coroutines for reactive CRUD operationsĮxtends CoroutineCrudRepository and adds methods for pagination Builtin Repository InterfacesĪ root interface that features no methods but defines the entity type and ID type as generic argumentsĮxtends GenericRepository and adds methods to perform CRUDĮxtends CrudRepository and adds JPA specific methods like merge and flush. The following table summarizes the repository interfaces that come with Micronaut Data: Table 1. Type Safety - Micronaut Data will actively check at compile time that a repository method can be implemented and fail compilation if it cannot. No Reflection or Runtime Proxies - Micronaut Data uses no reflection or runtime proxies, resulting in better performance, smaller stack traces and reduced memory consumption due to a complete lack of reflection caches (Note that the backing implementation, for example Hibernate, may use reflection). No such runtime translation exists in Micronaut Data and this work is carried out by the Micronaut compiler at compilation time. No query translation - Both GORM and Spring Data use regular expressions and pattern matching in combination with runtime generated proxies to translate a method definition on a Java interface into a query at runtime.

The problem is worse when combined with Hibernate which maintains its own meta-model as you end up with duplicate meta-models. This model consumes significant memory and memory requirements grow as your application size grows. No runtime model - Both GORM and Spring Data maintain a runtime meta-model that uses reflection to model relationships between entities.
