-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Avoid Native Queries #254
Avoid Native Queries #254
Conversation
WalkthroughThe recent updates involve modifying the Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- backend/src/main/java/org/cryptomator/hub/entities/AccessToken.java (2 hunks)
- backend/src/main/java/org/cryptomator/hub/entities/LegacyAccessToken.java (2 hunks)
- backend/src/main/java/org/cryptomator/hub/entities/LegacyDevice.java (1 hunks)
Additional comments: 3
backend/src/main/java/org/cryptomator/hub/entities/AccessToken.java (2)
- 23-28: The JPQL query in the
@NamedQuery
annotation forAccessToken.get
correctly replaces the native SQL query, aligning with the PR's objectives. Ensure that the join conditions and where clause accurately reflect the intended logic for access token retrieval. Additionally, validate the query's performance, especially considering the joins, to ensure it meets the application's scalability and efficiency requirements.- 50-50: The update to the
unlock
method to use the newAccessToken.get
named query is a direct application of the PR's objectives. Ensure that all usages of this method have been tested with the new JPQL query to confirm that the functionality remains consistent with the previous native SQL implementation.backend/src/main/java/org/cryptomator/hub/entities/LegacyAccessToken.java (1)
- 19-31: The transition from native SQL to JPQL in the
@NamedQuery
annotations forLegacyAccessToken.get
andLegacyAccessToken.getByDevice
is in line with the PR's goals. It's crucial to ensure that the JPQL syntax is correct and that the queries accurately represent the intended data retrieval logic. Pay special attention to the join conditions and where clauses to confirm they match the application's requirements. Additionally, consider the impact of these changes on performance and test accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- backend/src/main/java/org/cryptomator/hub/entities/LegacyDevice.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- backend/src/main/java/org/cryptomator/hub/entities/LegacyDevice.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice improvement and thanks for fixing :)
Fixes #222 by reverting native queries back to
@NamedQuery
.AccessToken
The unlock
@NamedQuery
avoids any join on User:Hibernate translates this to the following:
LegacyAccessToken
This is the
@NamedQuery
:Hibernate translates this to the following:
Summary by CodeRabbit
LegacyAccessToken
to enhance database compatibility.ownerId
field toLegacyDevice
for better ownership tracking.