HHH-20720 Copy @InterceptorBinding annotations for all repository types, not just @Repository#13109
HHH-20720 Copy @InterceptorBinding annotations for all repository types, not just @Repository#13109FroMage wants to merge 1 commit into
Conversation
…es, not just @repository Previously, inheritedAnnotations() only copied annotations with @InterceptorBinding (such as @transactional) to the generated implementation class when the interface was annotated with Jakarta Data's @repository. Quarkus Data repositories without @repository were excluded, so @transactional on their methods was silently lost. Widen the check from isJakartaDataRepository()/jakartaDataRepository to isRepository()/repository so that all processor-generated repository implementations inherit interceptor binding annotations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This is going to need a backport to 7.4. Do you want me to make the backport PR? There are conflicts, I've noticed. |
| @Override | ||
| public List<AnnotationMirror> inheritedAnnotations() { | ||
| if ( annotationMetaEntity.isJakartaDataRepository() ) { | ||
| if ( annotationMetaEntity.isRepository() ) { |
There was a problem hiding this comment.
Wouldn't that also affect Hibernate ORM's "native" repositories type? I seem to remember that was a thing -- you could use the annotation processor to generate (sort of) repositories even without Jakarta Data, using Hibernate-specific annotations.
I'm thinking of this in particular:
That said maybe it doesn't hurt to copy annotations there too...
There was a problem hiding this comment.
I can't see why it would hurt any repository, native or Jakarta Data to respect @Transactional
There was a problem hiding this comment.
Fair enough.
I suppose if we don't want such annotations on other repositories (e.g. because they're not CDI beans and thus @Transactional won't have an effect anyway), we should rather report a warning/error when we notice these annotations on other repositories.
|
You'll need a backport to 8.0 too. Please open the PRs, especially if there are conflicts :) |
|
@gavinking not merging yet in case you have an objection... |
|
Yeah, I'm not sure this is quite right. Copying interceptor annotations only makes sense when we know the object is instantiated as a CDI bean, and that's a special case which only gets enabled when |



Previously, inheritedAnnotations() only copied annotations with @InterceptorBinding (such as @transactional) to the generated implementation class when the interface was annotated with Jakarta Data's @repository. Quarkus Data repositories without @repository were excluded, so @transactional on their methods was silently lost.
Widen the check from isJakartaDataRepository()/jakartaDataRepository to isRepository()/repository so that all processor-generated repository implementations inherit interceptor binding annotations.
Upstream issue: quarkusio/quarkus#53622
Test is on Quarkus project, as usual.
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-20720 (Bug):
migration-guide.adocOR check there are no breaking changeshttps://hibernate.atlassian.net/browse/HHH-20720