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

Fix pageable queries with dynamic entity name #3245

Open
wants to merge 14 commits into
base: 4.10.x
Choose a base branch
from

Conversation

radovanradic
Copy link
Contributor

This is potential fix for issue when entity name has configurable value and uses Pageable in find.

@radovanradic radovanradic added the type: bug Something isn't working label Nov 25, 2024

private static Function<Object, Object> createEnvResolverValueMapper(Environment environment) {
return o -> {
PropertyPlaceholderResolver resolver = environment.getPlaceholderResolver();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed to replace default behavior from EnvironmentAnnotationValue which when finds property to resolve also expands strings when finds comma and this is causing this issue creating more query parts than actual parameters.

@JdbcRepository(dialect = Dialect.H2)
public interface CustomEntityRepository extends CrudRepository<CustomEntity, Long> {
Slice<CustomEntity> findAll(Pageable pageable);

Page<CustomEntity> findByNameIn(List<String> names, Pageable pageable);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add an example of a custom query with IN that does have an expression

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added 03324f5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might fix this issue as well #2959

Copy link

sonarcloud bot commented Nov 25, 2024

Copy link

sonarcloud bot commented Nov 25, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants