Search in sources :

Example 1 with RuntimePersistentEntity

use of io.micronaut.data.model.runtime.RuntimePersistentEntity in project micronaut-data by micronaut-projects.

the class DefaultJdbcRepositoryOperations method updateAll.

@NonNull
@Override
public <T> Iterable<T> updateAll(@NonNull UpdateBatchOperation<T> operation) {
    return executeWrite(connection -> {
        final AnnotationMetadata annotationMetadata = operation.getAnnotationMetadata();
        final Class<?> repositoryType = operation.getRepositoryType();
        SqlQueryBuilder queryBuilder = queryBuilders.getOrDefault(repositoryType, DEFAULT_SQL_BUILDER);
        final RuntimePersistentEntity<T> persistentEntity = getEntity(operation.getRootEntity());
        DBOperation dbOperation = new StoredQuerySqlOperation(queryBuilder, operation.getStoredQuery());
        JdbcOperationContext ctx = new JdbcOperationContext(annotationMetadata, repositoryType, queryBuilder.dialect(), connection);
        if (!isSupportsBatchUpdate(persistentEntity, queryBuilder.dialect())) {
            return operation.split().stream().map(updateOp -> {
                JdbcEntityOperations<T> op = new JdbcEntityOperations<>(ctx, persistentEntity, updateOp.getEntity(), dbOperation);
                op.update();
                return op.getEntity();
            }).collect(Collectors.toList());
        }
        JdbcEntitiesOperations<T> op = new JdbcEntitiesOperations<>(ctx, persistentEntity, operation, dbOperation);
        op.update();
        return op.getEntities();
    });
}
Also used : DataType(io.micronaut.data.model.DataType) Arrays(java.util.Arrays) ExecutorReactiveOperations(io.micronaut.data.runtime.operations.ExecutorReactiveOperations) Internal(io.micronaut.core.annotation.Internal) ResultSet(java.sql.ResultSet) Map(java.util.Map) DataJdbcConfiguration(io.micronaut.data.jdbc.config.DataJdbcConfiguration) ArgumentUtils(io.micronaut.core.util.ArgumentUtils) RuntimePersistentProperty(io.micronaut.data.model.runtime.RuntimePersistentProperty) DBOperation(io.micronaut.data.runtime.operations.internal.DBOperation) Set(java.util.Set) PreparedStatement(java.sql.PreparedStatement) Executors(java.util.concurrent.Executors) PreparedQuery(io.micronaut.data.model.runtime.PreparedQuery) Serializable(java.io.Serializable) Stream(java.util.stream.Stream) Dialect(io.micronaut.data.model.query.builder.sql.Dialect) Parameter(io.micronaut.context.annotation.Parameter) SqlDTOMapper(io.micronaut.data.runtime.mapper.sql.SqlDTOMapper) BeanProperty(io.micronaut.core.beans.BeanProperty) ArrayList(java.util.ArrayList) TypeMapper(io.micronaut.data.runtime.mapper.TypeMapper) SQLException(java.sql.SQLException) OperationContext(io.micronaut.data.runtime.operations.internal.OperationContext) Nullable(io.micronaut.core.annotation.Nullable) ReactiveCapableRepository(io.micronaut.data.operations.reactive.ReactiveCapableRepository) ExecutorAsyncOperations(io.micronaut.data.runtime.operations.ExecutorAsyncOperations) StreamSupport(java.util.stream.StreamSupport) Argument(io.micronaut.core.type.Argument) AbstractConversionContext(io.micronaut.data.runtime.support.AbstractConversionContext) JdbcConversionContext(io.micronaut.data.jdbc.convert.JdbcConversionContext) AttributeConverterRegistry(io.micronaut.data.model.runtime.AttributeConverterRegistry) ReactiveRepositoryOperations(io.micronaut.data.operations.reactive.ReactiveRepositoryOperations) StoredQuerySqlOperation(io.micronaut.data.runtime.operations.internal.StoredQuerySqlOperation) InsertBatchOperation(io.micronaut.data.model.runtime.InsertBatchOperation) JoinPath(io.micronaut.data.model.query.JoinPath) Statement(java.sql.Statement) InsertOperation(io.micronaut.data.model.runtime.InsertOperation) AbstractSyncEntitiesOperations(io.micronaut.data.runtime.operations.internal.AbstractSyncEntitiesOperations) UpdateBatchOperation(io.micronaut.data.model.runtime.UpdateBatchOperation) UpdateOperation(io.micronaut.data.model.runtime.UpdateOperation) RuntimePersistentPropertyConversionContext(io.micronaut.data.runtime.convert.RuntimePersistentPropertyConversionContext) Connection(java.sql.Connection) BeanContext(io.micronaut.context.BeanContext) Spliterators(java.util.Spliterators) LoggerFactory(org.slf4j.LoggerFactory) DataSourceUtils(io.micronaut.transaction.jdbc.DataSourceUtils) PreDestroy(javax.annotation.PreDestroy) EachBean(io.micronaut.context.annotation.EachBean) SqlQueryBuilder(io.micronaut.data.model.query.builder.sql.SqlQueryBuilder) DataAccessException(io.micronaut.data.exceptions.DataAccessException) DeleteOperation(io.micronaut.data.model.runtime.DeleteOperation) RuntimeAssociation(io.micronaut.data.model.runtime.RuntimeAssociation) AsyncCapableRepository(io.micronaut.data.operations.async.AsyncCapableRepository) DTOMapper(io.micronaut.data.runtime.mapper.DTOMapper) ConnectionCallback(io.micronaut.data.jdbc.runtime.ConnectionCallback) Predicate(java.util.function.Predicate) SqlResultConsumer(io.micronaut.data.jdbc.mapper.SqlResultConsumer) AbstractSqlRepositoryOperations(io.micronaut.data.runtime.operations.internal.AbstractSqlRepositoryOperations) PreparedStatementCallback(io.micronaut.data.jdbc.runtime.PreparedStatementCallback) Collectors(java.util.stream.Collectors) StoredSqlOperation(io.micronaut.data.runtime.operations.internal.StoredSqlOperation) Objects(java.util.Objects) List(java.util.List) Optional(java.util.Optional) SqlTypeMapper(io.micronaut.data.runtime.mapper.sql.SqlTypeMapper) Spliterator(java.util.Spliterator) Named(jakarta.inject.Named) ColumnIndexResultSetReader(io.micronaut.data.jdbc.mapper.ColumnIndexResultSetReader) QueryParameterBinding(io.micronaut.data.model.runtime.QueryParameterBinding) TransactionOperations(io.micronaut.transaction.TransactionOperations) ArgumentConversionContext(io.micronaut.core.convert.ArgumentConversionContext) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) RuntimeEntityRegistry(io.micronaut.data.model.runtime.RuntimeEntityRegistry) Function(java.util.function.Function) DelegatingDataSource(io.micronaut.transaction.jdbc.DelegatingDataSource) JdbcQueryStatement(io.micronaut.data.jdbc.mapper.JdbcQueryStatement) Page(io.micronaut.data.model.Page) DataSource(javax.sql.DataSource) OpContext(io.micronaut.data.runtime.operations.internal.OpContext) NoSuchElementException(java.util.NoSuchElementException) DateTimeProvider(io.micronaut.data.runtime.date.DateTimeProvider) ExecutorService(java.util.concurrent.ExecutorService) MediaTypeCodec(io.micronaut.http.codec.MediaTypeCodec) PagedQuery(io.micronaut.data.model.runtime.PagedQuery) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) AbstractSyncEntityOperations(io.micronaut.data.runtime.operations.internal.AbstractSyncEntityOperations) DataConversionService(io.micronaut.data.runtime.convert.DataConversionService) ResultConsumer(io.micronaut.data.runtime.mapper.ResultConsumer) SyncCascadeOperations(io.micronaut.data.runtime.operations.internal.SyncCascadeOperations) Consumer(java.util.function.Consumer) NonNull(io.micronaut.core.annotation.NonNull) ConversionContext(io.micronaut.core.convert.ConversionContext) ColumnNameResultSetReader(io.micronaut.data.jdbc.mapper.ColumnNameResultSetReader) DeleteBatchOperation(io.micronaut.data.model.runtime.DeleteBatchOperation) AnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata) RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) ResultReader(io.micronaut.data.runtime.mapper.ResultReader) SqlResultEntityTypeMapper(io.micronaut.data.runtime.mapper.sql.SqlResultEntityTypeMapper) SqlQueryBuilder(io.micronaut.data.model.query.builder.sql.SqlQueryBuilder) AnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata) DBOperation(io.micronaut.data.runtime.operations.internal.DBOperation) StoredQuerySqlOperation(io.micronaut.data.runtime.operations.internal.StoredQuerySqlOperation) NonNull(io.micronaut.core.annotation.NonNull)

Example 2 with RuntimePersistentEntity

use of io.micronaut.data.model.runtime.RuntimePersistentEntity in project micronaut-data by micronaut-projects.

the class EventIntegrator method integrate.

@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
    EventListenerRegistry eventListenerRegistry = serviceRegistry.getService(EventListenerRegistry.class);
    final EntityEventListener<Object> entityEventListener = entityRegistry.getEntityEventListener();
    eventListenerRegistry.getEventListenerGroup(EventType.PRE_INSERT).appendListener((PreInsertEventListener) event -> {
        Class mappedClass = event.getPersister().getMappedClass();
        if (isNotSupportedMappedClass(mappedClass)) {
            return false;
        }
        final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
        if (entity.hasPrePersistEventListeners()) {
            Object[] state = event.getState();
            final DefaultEntityEventContext<Object> context = new StatefulHibernateEventContext<>(entity, event, state);
            return !entityEventListener.prePersist(context);
        }
        return false;
    });
    eventListenerRegistry.getEventListenerGroup(EventType.POST_INSERT).appendListener(new PostInsertEventListener() {

        @Override
        public void onPostInsert(PostInsertEvent event) {
            Class mappedClass = event.getPersister().getMappedClass();
            if (isNotSupportedMappedClass(mappedClass)) {
                return;
            }
            final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
            if (entity.hasPostPersistEventListeners()) {
                final DefaultEntityEventContext<Object> context = new SimpleHibernateEventContext<>(entity, event.getEntity());
                entityEventListener.postPersist(context);
            }
        }

        @Override
        public boolean requiresPostCommitHanding(EntityPersister persister) {
            return false;
        }
    });
    eventListenerRegistry.getEventListenerGroup(EventType.PRE_DELETE).appendListener((PreDeleteEventListener) event -> {
        Class mappedClass = event.getPersister().getMappedClass();
        if (isNotSupportedMappedClass(mappedClass)) {
            return false;
        }
        final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
        if (entity.hasPreRemoveEventListeners()) {
            Object[] state = event.getDeletedState();
            final DefaultEntityEventContext<Object> context = new StatefulHibernateEventContext<>(entity, event, state);
            return !entityEventListener.preRemove(context);
        }
        return false;
    });
    eventListenerRegistry.getEventListenerGroup(EventType.POST_DELETE).appendListener(new PostDeleteEventListener() {

        @Override
        public boolean requiresPostCommitHanding(EntityPersister persister) {
            return false;
        }

        @Override
        public void onPostDelete(PostDeleteEvent event) {
            Class mappedClass = event.getPersister().getMappedClass();
            if (isNotSupportedMappedClass(mappedClass)) {
                return;
            }
            final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
            if (entity.hasPostPersistEventListeners()) {
                final DefaultEntityEventContext<Object> context = new SimpleHibernateEventContext<>(entity, event.getEntity());
                entityEventListener.postRemove(context);
            }
        }
    });
    eventListenerRegistry.getEventListenerGroup(EventType.PRE_UPDATE).appendListener((PreUpdateEventListener) event -> {
        Class mappedClass = event.getPersister().getMappedClass();
        if (isNotSupportedMappedClass(mappedClass)) {
            return false;
        }
        final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
        if (entity.hasPreUpdateEventListeners()) {
            Object[] state = event.getState();
            final DefaultEntityEventContext<Object> context = new StatefulHibernateEventContext<>(entity, event, state);
            return !entityEventListener.preUpdate(context);
        }
        return false;
    });
    eventListenerRegistry.getEventListenerGroup(EventType.POST_UPDATE).appendListener(new PostUpdateEventListener() {

        @Override
        public boolean requiresPostCommitHanding(EntityPersister persister) {
            return false;
        }

        @Override
        public void onPostUpdate(PostUpdateEvent event) {
            Class mappedClass = event.getPersister().getMappedClass();
            if (isNotSupportedMappedClass(mappedClass)) {
                return;
            }
            final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
            if (entity.hasPostPersistEventListeners()) {
                final DefaultEntityEventContext<Object> context = new SimpleHibernateEventContext<>(entity, event.getEntity());
                entityEventListener.postUpdate(context);
            }
        }
    });
    eventListenerRegistry.getEventListenerGroup(EventType.POST_LOAD).appendListener((PostLoadEventListener) event -> {
        Class mappedClass = event.getPersister().getMappedClass();
        if (isNotSupportedMappedClass(mappedClass)) {
            return;
        }
        final RuntimePersistentEntity<Object> entity = entityRegistry.getEntity(mappedClass);
        if (entity.hasPreUpdateEventListeners()) {
            final DefaultEntityEventContext<Object> context = new SimpleHibernateEventContext<>(entity, event.getEntity());
            entityEventListener.postLoad(context);
        }
    });
}
Also used : org.hibernate.event.spi(org.hibernate.event.spi) DefaultEntityEventContext(io.micronaut.data.runtime.event.DefaultEntityEventContext) Integrator(org.hibernate.integrator.spi.Integrator) EntityPersister(org.hibernate.persister.entity.EntityPersister) EntityEventListener(io.micronaut.data.event.EntityEventListener) EventListenerRegistry(org.hibernate.event.service.spi.EventListenerRegistry) BeanProperty(io.micronaut.core.beans.BeanProperty) Singleton(jakarta.inject.Singleton) RuntimeEntityRegistry(io.micronaut.data.model.runtime.RuntimeEntityRegistry) Metadata(org.hibernate.boot.Metadata) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) Internal(io.micronaut.core.annotation.Internal) SessionFactoryServiceRegistry(org.hibernate.service.spi.SessionFactoryServiceRegistry) Primary(io.micronaut.context.annotation.Primary) RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) BeanIntrospector(io.micronaut.core.beans.BeanIntrospector) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) EntityPersister(org.hibernate.persister.entity.EntityPersister) RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) DefaultEntityEventContext(io.micronaut.data.runtime.event.DefaultEntityEventContext) EventListenerRegistry(org.hibernate.event.service.spi.EventListenerRegistry)

Example 3 with RuntimePersistentEntity

use of io.micronaut.data.model.runtime.RuntimePersistentEntity in project micronaut-data by micronaut-projects.

the class HibernateJpaOperations method bindParameters.

private <T, R> void bindParameters(Query<?> q, @NonNull PreparedQuery<T, R> preparedQuery, String query) {
    for (QueryParameterBinding queryParameterBinding : preparedQuery.getQueryBindings()) {
        String parameterName = Objects.requireNonNull(queryParameterBinding.getName(), "Parameter name cannot be null!");
        Object value;
        if (queryParameterBinding.getParameterIndex() != -1) {
            value = resolveParameterValue(queryParameterBinding, preparedQuery.getParameterArray());
        } else if (queryParameterBinding.isAutoPopulated()) {
            String[] propertyPath = queryParameterBinding.getRequiredPropertyPath();
            RuntimePersistentEntity<T> persistentEntity = getEntity(preparedQuery.getRootEntity());
            PersistentPropertyPath pp = persistentEntity.getPropertyPath(propertyPath);
            if (pp == null) {
                throw new IllegalStateException("Cannot find auto populated property: " + String.join(".", propertyPath));
            }
            RuntimePersistentProperty<?> persistentProperty = (RuntimePersistentProperty) pp.getProperty();
            Object previousValue = null;
            QueryParameterBinding previousPopulatedValueParameter = queryParameterBinding.getPreviousPopulatedValueParameter();
            if (previousPopulatedValueParameter != null) {
                if (previousPopulatedValueParameter.getParameterIndex() == -1) {
                    throw new IllegalStateException("Previous value parameter cannot be bind!");
                }
                previousValue = resolveParameterValue(previousPopulatedValueParameter, preparedQuery.getParameterArray());
            }
            value = runtimeEntityRegistry.autoPopulateRuntimeProperty(persistentProperty, previousValue);
        } else {
            throw new IllegalStateException("Invalid query [" + query + "]. Unable to establish parameter value for parameter at name: " + parameterName);
        }
        if (preparedQuery.isNative()) {
            int parameterIndex = queryParameterBinding.getParameterIndex();
            Argument<?> argument = preparedQuery.getArguments()[parameterIndex];
            Class<?> argumentType = argument.getType();
            if (Collection.class.isAssignableFrom(argumentType)) {
                Type valueType = sessionFactory.getTypeHelper().heuristicType(argument.getFirstTypeVariable().orElse(Argument.OBJECT_ARGUMENT).getType().getName());
                if (valueType != null) {
                    q.setParameterList(parameterName, value == null ? Collections.emptyList() : (Collection<?>) value, valueType);
                    continue;
                }
            } else if (Object[].class.isAssignableFrom(argumentType)) {
                q.setParameterList(parameterName, value == null ? ArrayUtils.EMPTY_OBJECT_ARRAY : (Object[]) value);
                continue;
            } else if (value == null) {
                Type type = sessionFactory.getTypeHelper().heuristicType(argumentType.getName());
                if (type != null) {
                    q.setParameter(parameterName, null, type);
                    continue;
                }
            }
        }
        q.setParameter(parameterName, value);
    }
}
Also used : DataType(io.micronaut.data.model.DataType) FlushModeType(javax.persistence.FlushModeType) Type(org.hibernate.type.Type) QueryParameterBinding(io.micronaut.data.model.runtime.QueryParameterBinding) RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) Collection(java.util.Collection) PersistentPropertyPath(io.micronaut.data.model.PersistentPropertyPath) TypeHint(io.micronaut.core.annotation.TypeHint) QueryHint(io.micronaut.data.annotation.QueryHint) RuntimePersistentProperty(io.micronaut.data.model.runtime.RuntimePersistentProperty)

Example 4 with RuntimePersistentEntity

use of io.micronaut.data.model.runtime.RuntimePersistentEntity in project micronaut-data by micronaut-projects.

the class DefaultMongoRepositoryOperations method triggerPostLoad.

private <K> K triggerPostLoad(AnnotationMetadata annotationMetadata, RuntimePersistentEntity<K> persistentEntity, K entity) {
    if (persistentEntity.hasPostLoadEventListeners()) {
        entity = triggerPostLoad(entity, persistentEntity, annotationMetadata);
    }
    for (PersistentProperty pp : persistentEntity.getPersistentProperties()) {
        if (pp instanceof RuntimeAssociation) {
            RuntimeAssociation runtimeAssociation = (RuntimeAssociation) pp;
            Object o = runtimeAssociation.getProperty().get(entity);
            if (o == null) {
                continue;
            }
            RuntimePersistentEntity associatedEntity = runtimeAssociation.getAssociatedEntity();
            switch(runtimeAssociation.getKind()) {
                case MANY_TO_MANY:
                case ONE_TO_MANY:
                    if (o instanceof Iterable) {
                        for (Object value : ((Iterable) o)) {
                            triggerPostLoad(value, associatedEntity, annotationMetadata);
                        }
                    }
                    continue;
                case MANY_TO_ONE:
                case ONE_TO_ONE:
                case EMBEDDED:
                    triggerPostLoad(o, associatedEntity, annotationMetadata);
                    continue;
                default:
                    throw new IllegalStateException("Unknown kind: " + runtimeAssociation.getKind());
            }
        }
    }
    return entity;
}
Also used : RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) AggregateIterable(com.mongodb.client.AggregateIterable) FindIterable(com.mongodb.client.FindIterable) MongoIterable(com.mongodb.client.MongoIterable) RuntimeAssociation(io.micronaut.data.model.runtime.RuntimeAssociation) PersistentProperty(io.micronaut.data.model.PersistentProperty) RuntimePersistentProperty(io.micronaut.data.model.runtime.RuntimePersistentProperty)

Example 5 with RuntimePersistentEntity

use of io.micronaut.data.model.runtime.RuntimePersistentEntity in project micronaut-data by micronaut-projects.

the class DefaultMongoRepositoryOperations method createMongoDeleteManyOperation.

private <T> MongoEntitiesOperation<T> createMongoDeleteManyOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, Iterable<T> entities) {
    return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, false) {

        final MongoDatabase mongoDatabase = getDatabase(persistentEntity, ctx.repositoryType);

        final MongoCollection<T> collection = getCollection(mongoDatabase, persistentEntity, persistentEntity.getIntrospection().getBeanType());

        Map<Data, Bson> filters;

        @Override
        protected void collectAutoPopulatedPreviousValues() {
            filters = entities.stream().collect(Collectors.toMap(d -> d, d -> MongoUtils.filterByIdAndVersion(conversionService, persistentEntity, d.entity, collection.getCodecRegistry())));
        }

        @Override
        protected void execute() throws RuntimeException {
            List<Bson> filters = entities.stream().filter(d -> !d.vetoed).map(d -> this.filters.get(d)).collect(Collectors.toList());
            if (!filters.isEmpty()) {
                Bson filter = Filters.or(filters);
                if (QUERY_LOG.isDebugEnabled()) {
                    QUERY_LOG.debug("Executing Mongo 'deleteMany' with filter: {}", filter.toBsonDocument().toJson());
                }
                DeleteResult deleteResult = collection.deleteMany(ctx.clientSession, filter);
                modifiedCount = deleteResult.getDeletedCount();
            }
            if (persistentEntity.getVersion() != null) {
                int expected = (int) entities.stream().filter(d -> !d.vetoed).count();
                checkOptimisticLocking(expected, (int) modifiedCount);
            }
        }
    };
}
Also used : InsertManyResult(com.mongodb.client.result.InsertManyResult) DataType(io.micronaut.data.model.DataType) BeanContext(io.micronaut.context.BeanContext) Spliterators(java.util.Spliterators) MongoDatabase(com.mongodb.client.MongoDatabase) ExecutorReactiveOperations(io.micronaut.data.runtime.operations.ExecutorReactiveOperations) Internal(io.micronaut.core.annotation.Internal) BsonValue(org.bson.BsonValue) EachBean(io.micronaut.context.annotation.EachBean) StoredQuery(io.micronaut.data.model.runtime.StoredQuery) UpdateResult(com.mongodb.client.result.UpdateResult) Map(java.util.Map) DataAccessException(io.micronaut.data.exceptions.DataAccessException) DeleteOperation(io.micronaut.data.model.runtime.DeleteOperation) RuntimeAssociation(io.micronaut.data.model.runtime.RuntimeAssociation) CursorType(com.mongodb.CursorType) AsyncCapableRepository(io.micronaut.data.operations.async.AsyncCapableRepository) DeleteOneModel(com.mongodb.client.model.DeleteOneModel) PersistentProperty(io.micronaut.data.model.PersistentProperty) InsertOneResult(com.mongodb.client.result.InsertOneResult) RuntimePersistentProperty(io.micronaut.data.model.runtime.RuntimePersistentProperty) Predicate(java.util.function.Predicate) AggregateIterable(com.mongodb.client.AggregateIterable) Qualifiers(io.micronaut.inject.qualifiers.Qualifiers) BsonDocumentWrapper(org.bson.BsonDocumentWrapper) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) PreparedQuery(io.micronaut.data.model.runtime.PreparedQuery) Serializable(java.io.Serializable) List(java.util.List) Stream(java.util.stream.Stream) FindIterable(com.mongodb.client.FindIterable) Dialect(io.micronaut.data.model.query.builder.sql.Dialect) Optional(java.util.Optional) MongoSynchronousTransactionManager(io.micronaut.data.mongodb.transaction.MongoSynchronousTransactionManager) Spliterator(java.util.Spliterator) MongoAggregationOptions(io.micronaut.data.mongodb.operations.options.MongoAggregationOptions) Named(jakarta.inject.Named) MongoDatabaseFactory(io.micronaut.data.mongodb.database.MongoDatabaseFactory) ReplaceOneModel(com.mongodb.client.model.ReplaceOneModel) Parameter(io.micronaut.context.annotation.Parameter) MongoClient(com.mongodb.client.MongoClient) MongoCollection(com.mongodb.client.MongoCollection) BeanProperty(io.micronaut.core.beans.BeanProperty) RuntimeEntityRegistry(io.micronaut.data.model.runtime.RuntimeEntityRegistry) CodecRegistry(org.bson.codecs.configuration.CodecRegistry) RequiresSyncMongo(io.micronaut.data.mongodb.conf.RequiresSyncMongo) Function(java.util.function.Function) BsonDocument(org.bson.BsonDocument) ArrayList(java.util.ArrayList) Filters(com.mongodb.client.model.Filters) Bson(org.bson.conversions.Bson) MongoCursor(com.mongodb.client.MongoCursor) OperationContext(io.micronaut.data.runtime.operations.internal.OperationContext) Nullable(io.micronaut.core.annotation.Nullable) Page(io.micronaut.data.model.Page) Pageable(io.micronaut.data.model.Pageable) ReactiveCapableRepository(io.micronaut.data.operations.reactive.ReactiveCapableRepository) ExecutorAsyncOperations(io.micronaut.data.runtime.operations.ExecutorAsyncOperations) StreamSupport(java.util.stream.StreamSupport) AttributeConverterRegistry(io.micronaut.data.model.runtime.AttributeConverterRegistry) ReactiveRepositoryOperations(io.micronaut.data.operations.reactive.ReactiveRepositoryOperations) DateTimeProvider(io.micronaut.data.runtime.date.DateTimeProvider) ExecutorService(java.util.concurrent.ExecutorService) Collation(com.mongodb.client.model.Collation) MediaTypeCodec(io.micronaut.http.codec.MediaTypeCodec) PagedQuery(io.micronaut.data.model.runtime.PagedQuery) UpdateOneModel(com.mongodb.client.model.UpdateOneModel) MongoFindOptions(io.micronaut.data.mongodb.operations.options.MongoFindOptions) AbstractSyncEntityOperations(io.micronaut.data.runtime.operations.internal.AbstractSyncEntityOperations) DataConversionService(io.micronaut.data.runtime.convert.DataConversionService) InsertBatchOperation(io.micronaut.data.model.runtime.InsertBatchOperation) SyncCascadeOperations(io.micronaut.data.runtime.operations.internal.SyncCascadeOperations) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) NonNull(io.micronaut.core.annotation.NonNull) BulkWriteResult(com.mongodb.bulk.BulkWriteResult) DeleteResult(com.mongodb.client.result.DeleteResult) DeleteBatchOperation(io.micronaut.data.model.runtime.DeleteBatchOperation) InsertOperation(io.micronaut.data.model.runtime.InsertOperation) AbstractSyncEntitiesOperations(io.micronaut.data.runtime.operations.internal.AbstractSyncEntitiesOperations) AnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata) ClientSession(com.mongodb.client.ClientSession) RuntimePersistentEntity(io.micronaut.data.model.runtime.RuntimePersistentEntity) MongoIterable(com.mongodb.client.MongoIterable) UpdateBatchOperation(io.micronaut.data.model.runtime.UpdateBatchOperation) UpdateOperation(io.micronaut.data.model.runtime.UpdateOperation) Collections(java.util.Collections) MongoCollection(com.mongodb.client.MongoCollection) Map(java.util.Map) DeleteResult(com.mongodb.client.result.DeleteResult) MongoDatabase(com.mongodb.client.MongoDatabase) Bson(org.bson.conversions.Bson)

Aggregations

RuntimePersistentEntity (io.micronaut.data.model.runtime.RuntimePersistentEntity)17 BeanProperty (io.micronaut.core.beans.BeanProperty)12 RuntimeAssociation (io.micronaut.data.model.runtime.RuntimeAssociation)12 RuntimePersistentProperty (io.micronaut.data.model.runtime.RuntimePersistentProperty)12 Internal (io.micronaut.core.annotation.Internal)11 BeanContext (io.micronaut.context.BeanContext)10 AnnotationMetadata (io.micronaut.core.annotation.AnnotationMetadata)10 NonNull (io.micronaut.core.annotation.NonNull)10 DataType (io.micronaut.data.model.DataType)10 RuntimeEntityRegistry (io.micronaut.data.model.runtime.RuntimeEntityRegistry)10 ArrayList (java.util.ArrayList)10 List (java.util.List)10 EachBean (io.micronaut.context.annotation.EachBean)9 Parameter (io.micronaut.context.annotation.Parameter)9 Nullable (io.micronaut.core.annotation.Nullable)9 DataAccessException (io.micronaut.data.exceptions.DataAccessException)9 Page (io.micronaut.data.model.Page)9 Dialect (io.micronaut.data.model.query.builder.sql.Dialect)9 AttributeConverterRegistry (io.micronaut.data.model.runtime.AttributeConverterRegistry)9 DeleteBatchOperation (io.micronaut.data.model.runtime.DeleteBatchOperation)9