Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to disable query validation #3642

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

christophstrobl
Copy link
Member

Resolves: #1690

@@ -120,6 +122,8 @@ public JpaRepositoryFactory(EntityManager entityManager) {
}

this.crudMethodMetadata = crudMethodMetadataPostProcessor.getCrudMethodMetadata();
String p = SpringProperties.getProperty("spring.data.jpa.query.validate");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not apply any defaulting from inside our library.

@@ -118,6 +119,7 @@ public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSo
builder.addPropertyValue("transactionManager", transactionManagerRef.orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME));
builder.addPropertyReference("entityManager", entityManagerRefs.get(source));
builder.addPropertyValue(ESCAPE_CHARACTER_PROPERTY, getEscapeCharacter(source).orElse('\\'));
getQueryValidation(source).ifPresent(it -> builder.addPropertyValue(QUERY_VALIDATION, it));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need that one since we're not updating @EnableJpaRepositories

QueryRewriter queryRewriter, ValueExpressionDelegate valueExpressionDelegate) {
this(method, em, method.getRequiredAnnotatedQuery(), countQueryString, queryRewriter, valueExpressionDelegate);
QueryRewriter queryRewriter, ValueExpressionDelegate valueExpressionDelegate, boolean validation) {
this(method, em, method.getRequiredAnnotatedQuery(), countQueryString, queryRewriter, valueExpressionDelegate, validation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a QueryValidator object would make sense instead of a magic boolean. I can handle that during the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query validation significantly slows down application startup [DATAJPA-1370]
2 participants