diff --git a/extensions/panache/panache-hibernate-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheHibernateCommonResourceProcessor.java b/extensions/panache/panache-hibernate-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheHibernateCommonResourceProcessor.java index b764e7df152b0..85bfe3fb83ac3 100644 --- a/extensions/panache/panache-hibernate-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheHibernateCommonResourceProcessor.java +++ b/extensions/panache/panache-hibernate-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheHibernateCommonResourceProcessor.java @@ -106,7 +106,12 @@ void replaceFieldAccesses(CombinedIndexBuildItem index, PanacheJpaEntityAccessorsEnhancer entityAccessorsEnhancer = new PanacheJpaEntityAccessorsEnhancer(index.getIndex(), modelInfo); for (String entityClassName : entitiesWithExternallyAccessibleFields) { - transformers.produce(new BytecodeTransformerBuildItem(entityClassName, entityAccessorsEnhancer)); + final BytecodeTransformerBuildItem transformation = new BytecodeTransformerBuildItem.Builder() + .setClassToTransform(entityClassName) + .setCacheable(true) + .setVisitorFunction(entityAccessorsEnhancer) + .build(); + transformers.produce(transformation); } // Replace field access in application code with calls to accessors @@ -125,8 +130,13 @@ void replaceFieldAccesses(CombinedIndexBuildItem index, continue; } produced.add(cn); - transformers.produce( - new BytecodeTransformerBuildItem(cn, panacheFieldAccessEnhancer, entityClassNamesInternal)); + final BytecodeTransformerBuildItem transformation = new BytecodeTransformerBuildItem.Builder() + .setClassToTransform(cn) + .setCacheable(true) + .setVisitorFunction(panacheFieldAccessEnhancer) + .setRequireConstPoolEntry(entityClassNamesInternal) + .build(); + transformers.produce(transformation); } } }