Metamodel generator: allow implicit repositories for Panache Next#11775
Metamodel generator: allow implicit repositories for Panache Next#11775FroMage wants to merge 4 commits intohibernate:mainfrom
Conversation
|
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
c2dad7b to
89ff874
Compare
And 7.3. I'll send a PR to update the version on EDIT: #11779 |
tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java
Show resolved
Hide resolved
|
@gavinking I have more processor changes incoming for Quarkus Panache, do you prefer a separate JIRA and PR, or should I just pile them on here, whatever you prefer. |
|
Piling them up here sounds fine to me. |
|
I should have a third one Monday. Perhaps a fourth too. |
2b2b461 to
6b258df
Compare
|
Alright. This is ready for review and merge @gavinking, I don't have anything else incoming. |
…ry entity even for custom repos Fixes quarkusio#50177 The fix for this is in hibernate/hibernate-orm#11775
…e accessor method This is just the test, the job is at hibernate/hibernate-orm#11775 Fixes quarkusio#52492
|
I don't believe the CI failures are related, they don't appear to be :-/ |
tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java
Outdated
Show resolved
Hide resolved
...tamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Show resolved
Hide resolved
...tamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Show resolved
Hide resolved
...tamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Outdated
Show resolved
Hide resolved
tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java
Outdated
Show resolved
Hide resolved
I added the indexQueryInterfaces method before the elements were recursively visited to find nested entities. I did not realise we were visiting nested types twice: once with the primaryEntity set (by indexQueryInterfaces) and the second time without it, causing issues with nested repositories losing their primaryEntity in Quarkus Panache. I'm now removing indexQueryInterfaces in favour of the upstream recursion, adapted for keeping track of implicit primaryEntity.
…@delete queries This only happens in Quarkus Panache when we have an implicit JD repository with a @delete query method, because jakartaDataRepository is not set, but it should not matter, because this method is only defined by JD for repositories, so I don't think it makes any sense for it to be false. The result was code like this: @OverRide public long deleteByTitle(String title) { var _builder = session.getCriteriaBuilder(); var _query = _builder.createCriteriaDelete(Panache2Book.class); var _entity = _query.from(Panache2Book.class); _query.where( title==null ? _entity.get(Panache2Book_.title).isNull() : _builder.equal(_entity.get(Panache2Book_.title), title) ); try { return session.createMutationQuery(_query).executeUpdate(); } Note the missing catch. This is because the catch is conditional on jakartaDataRepository while the try is not conditional.
6b258df to
48c225b
Compare
|
So… a merge and backport? Please :) |
This is the processor side of quarkusio/quarkus#50178:
@RepositoryannotationAs it were, we were generating the accessors for these repositories without generating the repositories, leading to a compilation failure.
This is tested in Quarkus in quarkusio/quarkus#52425
I've opened this against
main, but a backport to7.2would be nice, since that's what we're using in Quarkus ATM.CC @gavinking
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
Please make sure that the following tasks are completed:
Tasks specific to HHH-20165 (Bug):
migration-guide.adocOR check there are no breaking changesTasks specific to HHH-20164 (Bug):
migration-guide.adocOR check there are no breaking changesTasks specific to HHH-20163 (Bug):
migration-guide.adocOR check there are no breaking changesTasks specific to HHH-20151 (Bug):
migration-guide.adocOR check there are no breaking changeshttps://hibernate.atlassian.net/browse/HHH-20165
https://hibernate.atlassian.net/browse/HHH-20164
https://hibernate.atlassian.net/browse/HHH-20151