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

Replace Hibernate with JDBI #1213

Closed
wants to merge 9 commits into from
Closed

Replace Hibernate with JDBI #1213

wants to merge 9 commits into from

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Apr 18, 2024

Description

As preparation for the work on #929, this PR removes usages of Hibernate, and introduces the more lightweight JDBI. JDBI has already been in active use in the API server and has proven its utility.

Addressed Issue

Relates to #929

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added the enhancement New feature or request label Apr 18, 2024
nscuro added 5 commits April 18, 2024 19:10
JDBI uses reflection to map `ResultSet`s to beans or `record`s.

Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
…tyDao`

Signed-off-by: nscuro <nscuro@protonmail.com>
By using SQL directly now, we were able to make the query behave case-insensitive on the CPE part columns. We now behave correctly according to the CPE spec!

\o/

Signed-off-by: nscuro <nscuro@protonmail.com>
nscuro added a commit to DependencyTrack/hyades-apiserver that referenced this pull request Apr 18, 2024
CPE matching must be case-insensitive as per CPE matching specification. We previously couldn't implement that, because defining indexes with computed columns was not possible in JDO.

As we're now using Liquibase, and switched the matching logic to use SQL instead of JDOQL / JPQL (DependencyTrack/hyades#1213), we can finally resolve this properly.

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro force-pushed the remove-hibernate branch from 90ef928 to faed8e8 Compare April 18, 2024 21:18
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
78.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro
Copy link
Member Author

nscuro commented Apr 22, 2024

Abandoning this for now. By hooking into Quarkus' config framework (https://quarkus.io/guides/config-extending-support#config-source-factory) we can't use any of the CDI beans anyway, and have to fall back to raw JDBC. No need for this migration right now.

@nscuro nscuro closed this Apr 22, 2024
@nscuro nscuro deleted the remove-hibernate branch June 14, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant