|
|
|
|
@ -19,8 +19,9 @@ package org.springframework.data.repository
@@ -19,8 +19,9 @@ package org.springframework.data.repository
|
|
|
|
|
* Retrieves an entity by its id. |
|
|
|
|
* |
|
|
|
|
* @param id the entity id. |
|
|
|
|
* @return the entity with the given id or `null` if none found |
|
|
|
|
* @return the entity with the given id or `null` if none found. |
|
|
|
|
* @author Sebastien Deleuze |
|
|
|
|
* @author Oscar Hernandez |
|
|
|
|
* @since 2.1.4 |
|
|
|
|
*/ |
|
|
|
|
fun <T, ID> CrudRepository<T, ID>.findByIdOrNull(id: ID): T? = findById(id!!).orElse(null) |
|
|
|
|
fun <T, ID: Any> CrudRepository<T, ID>.findByIdOrNull(id: ID): T? = findById(id).orElse(null) |
|
|
|
|
|