io.micronaut.data.annotation.Repository Java Examples
The following examples show how to use
io.micronaut.data.annotation.Repository.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringRepositoryMapper.java From micronaut-data with Apache License 2.0 | 5 votes |
@Override public List<AnnotationValue<?>> map(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final AnnotationValueBuilder<Repository> builder = AnnotationValue.builder(Repository.class); annotation.stringValue("org.springframework.stereotype.Repository").ifPresent(builder::value); return Collections.singletonList( builder .build() ); }
Example #2
Source File: DefaultJdbcRepositoryOperations.java From micronaut-data with Apache License 2.0 | 5 votes |
/** * Default constructor. * * @param dataSourceName The data source name * @param dataSource The datasource * @param transactionOperations The JDBC operations for the data source * @param executorService The executor service * @param beanContext The bean context * @param codecs The codecs * @param dateTimeProvider The dateTimeProvider */ protected DefaultJdbcRepositoryOperations(@Parameter String dataSourceName, DataSource dataSource, @Parameter TransactionOperations<Connection> transactionOperations, @Named("io") @Nullable ExecutorService executorService, BeanContext beanContext, List<MediaTypeCodec> codecs, @NonNull DateTimeProvider dateTimeProvider) { super( new ColumnNameResultSetReader(), new ColumnIndexResultSetReader(), new JdbcQueryStatement(), codecs, dateTimeProvider ); ArgumentUtils.requireNonNull("dataSource", dataSource); ArgumentUtils.requireNonNull("transactionOperations", transactionOperations); this.dataSource = dataSource; this.transactionOperations = transactionOperations; this.executorService = executorService; Collection<BeanDefinition<GenericRepository>> beanDefinitions = beanContext.getBeanDefinitions(GenericRepository.class, Qualifiers.byStereotype(Repository.class)); for (BeanDefinition<GenericRepository> beanDefinition : beanDefinitions) { String targetDs = beanDefinition.stringValue(Repository.class).orElse("default"); if (targetDs.equalsIgnoreCase(dataSourceName)) { Dialect dialect = beanDefinition.enumValue(JdbcRepository.class, "dialect", Dialect.class).orElseGet(() -> beanDefinition.enumValue(JdbcRepository.class, "dialectName", Dialect.class).orElse(Dialect.ANSI)); dialects.put(beanDefinition.getBeanType(), dialect); QueryBuilder qb = queryBuilders.get(dialect); if (qb == null) { queryBuilders.put(dialect, new SqlQueryBuilder(dialect)); } } } }