Skip to content

Commit

Permalink
Ignore elements annotated with @BsonIgnore for reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Dec 28, 2024
1 parent 0d3fee5 commit 192f777
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ protected void processRepositories(CombinedIndexBuildItem index,

for (Type parameterType : daoTypeParameters) {
// Register for reflection the type parameters of the repository: this should be the entity class and the ID class
reflectiveHierarchy.produce(ReflectiveHierarchyBuildItem.builder(parameterType).build());
reflectiveHierarchy.produce(ReflectiveHierarchyBuildItem.builder(parameterType)
.source(BasePanacheMongoResourceProcessor.class.getName())
.ignoreFieldPredicate(f -> f.hasAnnotation(BSON_IGNORE))
.ignoreMethodPredicate(m -> m.hasAnnotation(BSON_IGNORE))
.build());

// Register for building the property mapping cache
propertyMappingClass.produce(new PropertyMappingClassBuildStep(parameterType.name().toString()));
Expand Down

0 comments on commit 192f777

Please sign in to comment.