Skip to content

Commit

Permalink
Merge pull request #29598 from zedbeit/main
Browse files Browse the repository at this point in the history
Add hibernate.query.in_clause_parameter_padding as a supported configuration parameter
  • Loading branch information
gsmet authored Dec 5, 2022
2 parents fddf257 + d1dfafa commit b8d7ce0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,16 @@ public enum NullOrdering {
@ConfigItem(defaultValue = "none")
public NullOrdering defaultNullOrdering;

/**
* Enables IN clause parameter padding which improves statement caching.
*/
@ConfigItem(defaultValue = "true")
public boolean inClauseParameterPadding;

public boolean isAnyPropertySet() {
return queryPlanCacheMaxSize != DEFAULT_QUERY_PLAN_CACHE_MAX_SIZE
|| defaultNullOrdering != NullOrdering.NONE;
|| defaultNullOrdering != NullOrdering.NONE
|| !inClauseParameterPadding;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,9 @@ private static void producePersistenceUnitDescriptorFromConfig(
descriptor.getProperties().setProperty(AvailableSettings.DEFAULT_NULL_ORDERING,
persistenceUnitConfig.query.defaultNullOrdering.name().toLowerCase(Locale.ROOT));

descriptor.getProperties().setProperty(AvailableSettings.IN_CLAUSE_PARAMETER_PADDING,
String.valueOf(persistenceUnitConfig.query.inClauseParameterPadding));

// Disable sequence validations: they are reportedly slow, and people already get the same validation from normal schema validation
descriptor.getProperties().put(AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY,
SequenceMismatchStrategy.NONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ private static ParsedPersistenceXmlDescriptor generateReactivePersistenceUnit(
desc.getProperties().setProperty(AvailableSettings.DEFAULT_NULL_ORDERING,
persistenceUnitConfig.query.defaultNullOrdering.name().toLowerCase());

desc.getProperties().setProperty(AvailableSettings.IN_CLAUSE_PARAMETER_PADDING,
String.valueOf(persistenceUnitConfig.query.inClauseParameterPadding));

// JDBC
persistenceUnitConfig.jdbc.statementBatchSize.ifPresent(
statementBatchSize -> desc.getProperties().setProperty(AvailableSettings.STATEMENT_BATCH_SIZE,
Expand Down

0 comments on commit b8d7ce0

Please sign in to comment.