spring-data-jpa icon indicating copy to clipboard operation
spring-data-jpa copied to clipboard

Introduce `QueryEnhancerSelector` to configure which `QueryEnhancerFactory` to use

Open mp911de opened this issue 1 year ago • 0 comments

This is a draft for configuring a QueryEnhancerSelector that selects a QueryEnhancerFactory based on a DeclaredQuery:

@EnableJpaRepositories(queryEnhancerSelector = MyQueryEnhancerSelector.class)

class MyQueryEnhancerSelector extends QueryEnhancerSelector.DefaultQueryEnhancerSelector {
	public MyQueryEnhancerSelector() {
		super(QueryEnhancerFactories.fallback(), DefaultQueryEnhancerSelector.jpql());
	}
}

This change requires decoupling of DeclaredQuery (the declaration aspect) and the introspected part (IntrospectedQuery) to avoid the logical cycle of introspecting a query upon DeclaredQuery creation.

Closes #3622

mp911de avatar Jun 27 '24 09:06 mp911de