Skip to content

Comments

Add config option to disable query validation#3642

Open
christophstrobl wants to merge 3 commits intomainfrom
issue/1690
Open

Add config option to disable query validation#3642
christophstrobl wants to merge 3 commits intomainfrom
issue/1690

Conversation

@christophstrobl
Copy link
Member

Resolves: #1690

}

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.

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.

@christophstrobl christophstrobl marked this pull request as ready for review March 3, 2025 06:47
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