Skip to content

HHH-19374, HHH-19375, HHH-19425 backport to 6.6 #10060

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

Merged
merged 3 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic;
import javax.tools.FileObject;
import java.io.IOException;
Expand Down Expand Up @@ -174,6 +175,10 @@ else if (argument instanceof AnnotationMirror) {
AnnotationMirror childAnnotation = (AnnotationMirror) argument;
printAnnotation( childAnnotation, pw );
}
else if (argument instanceof TypeMirror) {
pw.print(argument);
pw.print(".class");
}
else if (argument instanceof List) {
final List<? extends AnnotationValue> list =
(List<? extends AnnotationValue>) argument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ private boolean handleSettings(ProcessingEnvironment environment) {
final PackageElement quarkusOrmPackage =
context.getProcessingEnvironment().getElementUtils()
.getPackageElement( "io.quarkus.hibernate.orm" );
final PackageElement quarkusReactivePackage =
context.getProcessingEnvironment().getElementUtils()
.getPackageElement( "io.quarkus.hibernate.reactive.runtime" );

PackageElement quarkusOrmPanachePackage =
context.getProcessingEnvironment().getElementUtils()
Expand All @@ -252,7 +255,7 @@ && packagePresent(quarkusOrmPanachePackage) ) {
context.setAddGeneratedAnnotation( packagePresent(jakartaAnnotationPackage) );
context.setAddDependentAnnotation( packagePresent(jakartaContextPackage) );
context.setAddTransactionScopedAnnotation( packagePresent(jakartaTransactionPackage) );
context.setQuarkusInjection( packagePresent(quarkusOrmPackage) );
context.setQuarkusInjection( packagePresent(quarkusOrmPackage) || packagePresent(quarkusReactivePackage) );
context.setUsesQuarkusOrm( packagePresent(quarkusOrmPanachePackage) );
context.setUsesQuarkusReactive( packagePresent(quarkusReactivePanachePackage) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,15 @@ public boolean isInjectable() {

@Override
public String scope() {
if (jakartaDataRepository) {
return context.addTransactionScopedAnnotation()
? "jakarta.transaction.TransactionScoped"
: "jakarta.enterprise.context.RequestScoped";
}
else {
return "jakarta.enterprise.context.Dependent";
}
// @TransactionScoped doesn't work here because repositories
// are supposed to be able to demarcate transactions, which
// means they should be injectable when there is no active tx
// @RequestScoped doesn't work because Arc folks think this
// scope should only be active during a HTTP request, which
// is simply wrong according to me, but whatever
// @ApplicationScoped could work in principle, but buys us
// nothing additional, since repositories are stateless
return "jakarta.enterprise.context.Dependent";
}

@Override
Expand Down
Loading