org.springframework.data.jdbc.core.JdbcAggregateTemplate Java Examples

The following examples show how to use org.springframework.data.jdbc.core.JdbcAggregateTemplate. 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: QuerydslJdbcRepositoryFactory.java    From infobip-spring-data-querydsl with Apache License 2.0 6 votes vote down vote up
@Override
protected Object getTargetRepository(RepositoryInformation repositoryInformation) {

    JdbcAggregateTemplate template = new JdbcAggregateTemplate(publisher, context, converter, accessStrategy);

    Class<?> type = repositoryInformation.getDomainType();
    RelationalPath<?> relationalPathBase = getRelationalPathBase(repositoryInformation);
    ConstructorExpression<?> constructor = getConstructorExpression(type, relationalPathBase);
    SimpleQuerydslJdbcRepository<?, ?> repository = new SimpleQuerydslJdbcRepository(template,
                                                                                        context.getRequiredPersistentEntity(
                                                                                                type),
                                                                                        sqlQueryFactory,
                                                                                        constructor,
                                                                                        relationalPathBase);

    if (entityCallbacks != null) {
        template.setEntityCallbacks(entityCallbacks);
    }

    return repository;
}
 
Example #2
Source File: JdbcFixture.java    From spring-data-dev-tools with Apache License 2.0 6 votes vote down vote up
private static void disableEntityCallbacks(ApplicationContext context) {
	
	JdbcBookRepository repository = context.getBean(JdbcBookRepository.class);

	Field field = ReflectionUtils.findField(SimpleJdbcRepository.class, "entityOperations");
	ReflectionUtils.makeAccessible(field);
	
	try {
		JdbcAggregateTemplate aggregateTemplate = (JdbcAggregateTemplate) ReflectionUtils.getField(field,
				((Advised) repository).getTargetSource().getTarget());

		field = ReflectionUtils.findField(JdbcAggregateTemplate.class, "publisher");
		ReflectionUtils.makeAccessible(field);
		ReflectionUtils.setField(field, aggregateTemplate, NoOpApplicationEventPublisher.INSTANCE);
		
		aggregateTemplate.setEntityCallbacks(NoOpEntityCallbacks.INSTANCE);
		
	} catch (Exception o_O) {
		throw new RuntimeException(o_O);
	}
}
 
Example #3
Source File: WithInsertImpl.java    From spring-data-examples with Apache License 2.0 4 votes vote down vote up
public WithInsertImpl(JdbcAggregateTemplate template) {
	this.template = template;
}