diff --git a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java index 30e4ff2ecc..a34c5d4634 100755 --- a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java +++ b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java @@ -65,6 +65,7 @@ * @author Donghun Shin * @author Greg Turnquist * @author Aref Behboodi + * @author Ngoc Nhan */ @Transactional(readOnly = true) public class EnversRevisionRepositoryImpl> @@ -116,7 +117,7 @@ public Optional> findRevision(ID id, N revisionNumber) { Assert.notNull(id, "Identifier must not be null!"); Assert.notNull(revisionNumber, "Revision number must not be null!"); - List singleResult = (List) createBaseQuery(id) // + List singleResult = createBaseQuery(id) // .add(AuditEntity.revisionNumber().eq(revisionNumber)) // .getResultList(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/AbstractPersistable.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/AbstractPersistable.java index 63fa8307e6..f351c8c961 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/AbstractPersistable.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/AbstractPersistable.java @@ -34,6 +34,7 @@ * @author Thomas Darimont * @author Mark Paluch * @author Greg Turnquist + * @author Ngoc Nhan * @param the type of the identifier. */ @MappedSuperclass @@ -89,7 +90,7 @@ public boolean equals(Object obj) { AbstractPersistable that = (AbstractPersistable) obj; - return null == this.getId() ? false : this.getId().equals(that.getId()); + return this.getId() != null && this.getId().equals(that.getId()); } @Override diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java index a28bf8a390..fd856a8fcd 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java @@ -37,6 +37,7 @@ * @author Christoph Strobl * @author David Madden * @author Jens Schauder + * @author Ngoc Nhan */ public class JpaSort extends Sort { @@ -281,14 +282,14 @@ public , U> Path dot(A attribute) { * @return */ public

, U> Path dot(P attribute) { - return new Path(add(attribute)); + return new Path<>(add(attribute)); } private List> add(Attribute attribute) { Assert.notNull(attribute, "Attribute must not be null"); - List> newAttributes = new ArrayList>(attributes.size() + 1); + List> newAttributes = new ArrayList<>(attributes.size() + 1); newAttributes.addAll(attributes); newAttributes.add(attribute); return newAttributes;