-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
JPA Static Metamodel Generator #29068
Comments
/cc @Sanne, @gavinking, @gsmet, @mswatosh, @yrodiere |
good idea! we also need this feature! |
Are we talking about the generate-code goal of quarkus-maven-plugin (gradle respectively)? I suppose in multi-module projects in which you might have a persistence module (=not where the actual quarkus app is built) you are either out of luck or you have to add the plugin but just with the generate-code goal? |
@famod |
Not sure I understand what you mean, but if one of the modules doesn't use Quarkus, they can add the required dependency on the classpath. But if the entities are on the classpath of the Quarkus app, there should be a way to see them and generate the metamodel classes |
My point is when to generate the classes. If you have a persistence module then chances are you have some repo/dao/service code in there that wants to use the generated metamodel classes. |
So how compatible is the hibernate jpamodelgen dependency with quarkus 2.16.4.Final currently? |
As far as I can tell it should work? This issue is not about making it work, it's about having Quarkus generate the static metamodel instead of forcing you to use a separate maven plugin. |
@Sanne, continuing from #32615:
Yes, agreed!
I can't speak for all those users, but for me such an entity (or "persistence") module is usually not external; it's usually a module in my main repo. |
I think I can get it done in #36168 using a variant of I wonder if @fbricon @sbouchet or @angelozerr can answer this question: If we make one APT plugin run automatically (via the |
In eclipse/vscode-java land, m2e now automatically runs all plugins by default (not that I agree with that decision). So it might just work. Or not. Annotation processors in the classpath or defined in the maven-compiler-plugin config (or some supported annotation plugin) would get automatically invoked on each incremental build. It generally works well. |
Uh, I have no observed that Eclipse ran plugins such as Normally, I can rely on Eclipse incremental compilation (and APT) and it doesn't get in the way of |
Note that in 806bf2d we already automatically ran one APT processor for all Gradle builds, so there's precedent. |
Hey @pipinet. Once again: please open a GitHub Discussion instead of hijacking an existing issue: it's bad form. |
JPA defines a typesafe Criteria API which allows Criteria queries to be constructed in a strongly-typed manner, utilizing so called static metamodel classes. For developers it is important that the task of the metamodel generation can be automated.
Hibernate provides an annotation processor that generates the classes automatically.
This usually requires adding a dependency to the project and/or configure the build tool.
Would it be possible for Quarkus to generate the metamodel everytime Hibernate ORM is on the classpath?
Hibernate 5.6 JPA static metamodel generator documentation
Hibernate 6.1 JPA static metamodel generator documentation
The text was updated successfully, but these errors were encountered: