Skip to content

Commit

Permalink
Merge pull request #45306 from gsmet/fix-mongodb-panache-reflection
Browse files Browse the repository at this point in the history
Ignore elements annotated with @BsonIgnore for reflection
  • Loading branch information
geoand authored Dec 30, 2024
2 parents c3ccc13 + 192f777 commit ed9bb15
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 ed9bb15

Please sign in to comment.