Class LcReactiveDataRelationalClient


  • @Component
    public class LcReactiveDataRelationalClient
    extends Object
    Reactive client for a relational database connection handling features such as join, lazy loading, persistence, deletion...
    Author:
    Guillaume Le Cousin
    • Field Detail

      • logger

        public static final org.apache.commons.logging.Log logger
    • Method Detail

      • getSpringClient

        public org.springframework.r2dbc.core.DatabaseClient getSpringClient()
        Returns:
        the Spring R2DBC database client.
      • getDialect

        public org.springframework.data.r2dbc.dialect.R2dbcDialect getDialect()
        Returns:
        the R2DBC native dialect.
      • dropSchemaContent

        public reactor.core.publisher.Mono<Void> dropSchemaContent​(RelationalDatabaseSchema schema)
        Drop all elements from the given schema.
      • createSchemaContent

        public reactor.core.publisher.Mono<Void> createSchemaContent​(RelationalDatabaseSchema schema)
        Create tables, constraints and sequences from the given schema.
      • dropCreateSchemaContent

        public reactor.core.publisher.Mono<Void> dropCreateSchemaContent​(RelationalDatabaseSchema schema)
        Drop then create the given schema.
      • buildSchemaFromEntities

        public RelationalDatabaseSchema buildSchemaFromEntities()
        Build the schema definition from all known entities.
      • save

        public <T> reactor.core.publisher.Mono<T> save​(T entity)
        Save the given entity (insert or update in cascade).
      • save

        public <T> reactor.core.publisher.Flux<T> save​(Iterable<T> entities)
        Save the given entities (insert or update in cascade).
      • save

        public <T> reactor.core.publisher.Flux<T> save​(org.reactivestreams.Publisher<T> publisher)
        Save the given entities (insert or update in cascade).
      • saveAll

        public reactor.core.publisher.Mono<Void> saveAll​(Iterable<Object> entities)
        Save the given entities (insert or update in cascade).
      • saveAll

        public reactor.core.publisher.Mono<Void> saveAll​(Object... entities)
        Save the given entities (insert or update in cascade).
      • getInstance

        public <T> EntityInstance<T> getInstance​(T entity)
      • lazyLoad

        public <T> reactor.core.publisher.Mono<T> lazyLoad​(T entity)
        Load the given entity from database.
      • lazyLoadInstance

        public <T> reactor.core.publisher.Mono<EntityInstance<T>> lazyLoadInstance​(EntityInstance<T> instance)
        Load the given entity from database.
      • execute

        public <T> reactor.core.publisher.Flux<T> execute​(SelectQuery<T> query,
                                                          @Nullable
                                                          LcEntityReader reader)
        Execute a select query using the given LcEntityReader to map rows to entities.
      • executeCount

        public reactor.core.publisher.Mono<Long> executeCount​(SelectQuery<?> query)
        Execute a select query.
      • delete

        public <T> reactor.core.publisher.Mono<Void> delete​(T entity)
        Delete the given entity (with cascade).
      • delete

        public <T> reactor.core.publisher.Mono<Void> delete​(Iterable<T> entities)
        Delete the given entities (with cascade).
      • delete

        public <T> reactor.core.publisher.Mono<Void> delete​(org.reactivestreams.Publisher<T> publisher)
        Delete the given entities (with cascade).
      • delete

        public <T> reactor.core.publisher.Mono<Void> delete​(org.reactivestreams.Publisher<T> publisher,
                                                            int bunchSize,
                                                            Duration bunchTimeout)
        Delete the given entities (with cascade), by bunch.
        Parameters:
        publisher - entities to delete
        bunchSize - bufferize entities to delete them by bunch
        bunchTimeout - timeout after which a the current bunch of entities are deleted even the bunch is not full