DATAJPA-1754 - Checks that the entity passed to save is not null.

Before this change a null value would have yielded an ambiguous exception, instead of a proper IllegalArgumentException.

Signed-off-by: Jens Schauder <jschauder@vmware.com>
This commit is contained in:
Jens Schauder
2020-07-10 15:01:36 +02:00
parent fc9d0a8ca9
commit b0a6f926bd

View File

@@ -550,6 +550,8 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
@Override
public <S extends T> S save(S entity) {
Assert.notNull(entity, "Entity must not be null.");
if (entityInformation.isNew(entity)) {
em.persist(entity);
return entity;