From 26554e303198f2dd7ddbad2fc828f2a4f7e96f77 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 16 Sep 2022 14:51:48 +0200 Subject: [PATCH] Polishing. See #4061 Original pull request: #4062. --- .../data/mongodb/core/EntityOperations.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java index 0da27dc20..167792262 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java @@ -139,9 +139,12 @@ class EntityOperations { } MongoPersistentEntity persistentEntity = context.getPersistentEntity(entityClass); - if(persistentEntity == null) { - throw new MappingException(String.format("Collection name cannot be derived for type %s. Is it a store native type?", entityClass)); + + if (persistentEntity == null) { + throw new MappingException(String.format( + "Cannot determine collection name from type '%s'. Is it a store native type?", entityClass.getName())); } + return persistentEntity.getCollection(); }