Skip to content

JPA static metamodel / Jakarta Data tests, dependency management and documentation #44278

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

Closed
yrodiere opened this issue Nov 4, 2024 · 13 comments · Fixed by #47012
Closed

JPA static metamodel / Jakarta Data tests, dependency management and documentation #44278

yrodiere opened this issue Nov 4, 2024 · 13 comments · Fixed by #47012
Assignees
Labels
area/hibernate-orm Hibernate ORM area/hibernate-reactive Hibernate Reactive area/jakarta good first issue Good for newcomers kind/enhancement New feature or request
Milestone

Comments

@yrodiere
Copy link
Member

yrodiere commented Nov 4, 2024

Description

We currently don't have guidance regarding the use of the JPA static metamodel or Jakarta Data in Quarkus.

Ultimately we will want to handle Jakarta Data in Panache and provide an integrated developer experience, but:

  1. This will require Panache 2, which still requires some time before it can get out.
  2. Some people will not be using Panache anyway.

So, let's:

  • Add dependency management for Jakarta Data dependencies, aligned on whatever Hibernate ORM requires/implements
  • Document how to use the JPA static metamodel and Jakarta Data in Quarkus. In particular Jakarta Data requires an additional runtime dependency.
  • Document known limitations. In particular, I suspect the annotation processor won't work great in dev mode, at least in Gradle -- I think @FroMage made it work with Maven, at least.
  • Add integration tests.
  • Perhaps, add a quickstart.

Implementation ideas

No response

Copy link

quarkus-bot bot commented Nov 4, 2024

/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @gsmet (hibernate-orm,jakarta)

@maxandersen
Copy link
Member

related to #35603

@FroMage
Copy link
Member

FroMage commented Nov 4, 2024

I suspect the annotation processor won't work great in dev mode, at least in Gradle -- I think @FroMage made it work with Maven, at least.

I also added support for Gradle a while ago so we're good :)

@yrodiere yrodiere changed the title JPA static metamodel / Jakarta Data tests and documentation JPA static metamodel / Jakarta Data tests, dependency management and documentation Nov 6, 2024
@yrodiere
Copy link
Member Author

yrodiere commented Nov 6, 2024

We will need to think about dependency management for Jakarta Data as well.

@gavinking
Copy link

So honestly this is a bit of a Shit User Story:

Hibernate Data Repositories 6.6 works in Quarkus. Just add:

  • jakarta.data:jakarta.data-api and
  • org.hibernate.orm:hibernate-jpamodelgen

as dependencies via Maven.

As of Jakarta Persistence 3.2, Hibernate Processor is an integral part of the programming model, but even for earlier versions it's annoying to have it not be there by default.

And the Jakarta Data API is tiny, I really see no particularly good reason to not just include it in the Hibernate ORM extension.

WDYT @yrodiere @maxandersen @FroMage ?

@FroMage
Copy link
Member

FroMage commented Dec 16, 2024

As for JD, sure.

But hibernate-jpamodelgen has to be added as an APT processor to the compiler options. Not as a "regular" dependency.

We do have an issue open to investigate making this automatic, but it requires support from tooling.

@gavinking
Copy link

Without this, is there any way to not have to manually change my Maven pom to select the correct version of Hibernate Processor every time I update Quarkus?

@gsmet
Copy link
Member

gsmet commented Dec 16, 2024

Without this, is there any way to not have to manually change my Maven pom to select the correct version of Hibernate Processor every time I update Quarkus?

Yes. Since a few versions, the Maven Compiler plugin is taking the version from the dependency management if available: https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#annotationProcessorPaths (see the comment in the example).

It can also apply the dependency management to the dependencies of the annotation processor (see option below).

@gavinking
Copy link

Oh, OK, thanks, that's not so bad then.

@gavinking
Copy link

gavinking commented Dec 16, 2024

Tried it; it worked.

@gsmet It's Maven only, I suppose? Anything similar for Gradle?

@gsmet
Copy link
Member

gsmet commented Dec 16, 2024

I have no idea how Gradle handles it and if they do. All I could find that could apply was https://stackoverflow.com/a/70397869/5043585 so it might be supported with the extra config.

In the Maven world, they introduced this feature fairly recently.

@gavinking
Copy link

OK.

@yrodiere
Copy link
Member Author

As of Jakarta Persistence 3.2, Hibernate Processor is an integral part of the programming model, but even for earlier versions it's annoying to have it not be there by default.

Agreed it's annoying, but as explained above, doing otherwise would require much more control over app developers' tooling than we currently have.

Adding the processor to the BOM will have to do.

And the Jakarta Data API is tiny, I really see no particularly good reason to not just include it in the Hibernate ORM extension.

WDYT @yrodiere @maxandersen @FroMage ?

I wonder why it's not a dependency of hibernate-core itself, if that's the case.

I agree it should be part of our BOM at least. As to adding it as a dependency of quarkus-hibernate-orm... I'd personally prefer handling that through Panache 2's dependencies, but in the end I guess I'm +0.

@quarkus-bot quarkus-bot bot added this to the 3.22 - main milestone Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/hibernate-reactive Hibernate Reactive area/jakarta good first issue Good for newcomers kind/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants