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

chore: Register JpaFilterConverter in a way that can be overridden #20745

Closed
wants to merge 4 commits into from

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Dec 18, 2024

@@ -142,4 +144,10 @@ public ServerEndpointExporter websocketEndpointDeployer() {
return new VaadinWebsocketEndpointExporter();
}

@Bean
@ConditionalOnMissingBean
public JpaFilterConverter jpaFilterConverter(EntityManager entityManager) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not want this Bean as flow user. Additionally it might be problematic for projects without JPA because of the EntityManager (so conditional on missing bean is not enough)

Copy link
Contributor

Choose a reason for hiding this comment

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

And wait.. is this the code that made "Hilla utterly broken with multiple Data sources"? I'm strict against this in flow!

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds like this is something personal. Can we discuss the merits of the code instead and what it is useful for

Copy link
Member Author

Choose a reason for hiding this comment

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

As you can see from the description, it is supposed to fix vaadin/hilla#2569, not introduce it to all Flow users

Copy link
Contributor

Choose a reason for hiding this comment

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

It's added to "SpringBootAutoConfiguration" which effects flow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, that is the point of this PR. To add the features to Flow and not only restrict them to Hilla

Copy link
Contributor

Choose a reason for hiding this comment

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

Your last two comments are kinda conflicting?

But nevertheless back to code - this JPAFilter probably has to be added in a second AutoConfiguration class to ensure it's only loaded with JPA and Spring Data in use.. or does it have to be a bean at all? It looks just like some helper methods that need access to the EntityManager.. with the "move" to flow and re-creating of all classes.. it's binary incompatible anyway so perfect timing for breaking changes.

Just a quick note on the other code:

  • doing lowercasr on a database column by default might be a performance problem with big tables without proper indexes
  • the string concatenation for like looks un-sanitized

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's see first where #20743 ends up. The original version in Hilla contained quite a bit of magic and this PR now contains way less of it

Copy link
Member Author

Choose a reason for hiding this comment

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

Your last two comments are kinda conflicting?

The point is to introduce the features to all Flow users but not to introduce the problem to all Flow users

Copy link

sonarcloud bot commented Dec 18, 2024

Copy link

Test Results

1 015 files   - 144  1 015 suites   - 144   1h 23m 2s ⏱️ - 6m 9s
7 402 tests  - 166  7 250 ✅  - 262  55 💤  -  1   8 ❌ + 8   89 🔥 + 89 
7 528 runs   - 386  7 338 ✅  - 511  54 💤  - 11  19 ❌ +19  117 🔥 +117 

For more details on these failures and errors, see this check.

Results for commit aa83b9d. ± Comparison against base commit fb02577.

This pull request removes 166 tests.
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ access_restricted_to_admin
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ access_restricted_to_logged_in_users
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ adminAppliesForHugeLoan_accessGranted
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ adminAppliesForLoan_accessDenied
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ anonymous_forwardToPrivatePage_loginViewShown
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ anonymous_linkToPrivatePageWithAlias_loginViewShown
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ anonymous_linkToPrivatePage_loginViewShown
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ anonymous_rerouteToPrivatePage_loginViewShown
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ client_menu_routes_correct_for_admin
com.vaadin.flow.spring.flowsecurity.AppViewIT ‑ client_menu_routes_correct_for_anonymous
…

@Artur- Artur- force-pushed the register-jpafilterconverter branch from aa83b9d to bd81a3b Compare December 18, 2024 12:30
@Artur-
Copy link
Member Author

Artur- commented Dec 18, 2024

This should not be needed at all

@Artur- Artur- closed this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLOCKER: Cannot upgrade to Vaadin 24.4 because of com.vaadin.hilla.crud.JpaFilterConverter
3 participants