rocketraman
10/05/2017, 2:08 PMorangy
veiset
10/06/2017, 8:24 AMMyType?
and handling it later or is there a more elegant way of doing it?qwert_ukg
10/06/2017, 8:26 AMveiset
10/06/2017, 8:28 AMsdeleuze
10/06/2017, 8:29 AMCrudRepository
does not return null
anymoer I think, see https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.htmlsdeleuze
10/06/2017, 8:29 AMsdeleuze
10/06/2017, 8:30 AMsdeleuze
10/06/2017, 8:30 AMveiset
10/06/2017, 8:30 AMsdeleuze
10/06/2017, 8:30 AMqwert_ukg
10/06/2017, 8:30 AMveiset
10/06/2017, 8:31 AMsdeleuze
10/06/2017, 8:31 AMOptional
instead of nullable return value, there is pro and con for that but for Java 8+ and this use case that probably the right thing to do.qwert_ukg
10/06/2017, 8:31 AMrepo.findOne(id)
sdeleuze
10/06/2017, 8:31 AMsdeleuze
10/06/2017, 8:32 AMsdeleuze
10/06/2017, 8:32 AMveiset
10/06/2017, 8:32 AMsdeleuze
10/06/2017, 8:33 AMsdeleuze
10/06/2017, 8:33 AMnull
versus throwing an exeception behaviorqwert_ukg
10/06/2017, 8:35 AMveiset
10/06/2017, 8:36 AMfun findOneByMarefAndMaid(maref: Int, maid: Int): MyType
and it will not complain about it possibly being null, and will crash later when I try to destruct MyType
at a later time.sdeleuze
10/06/2017, 8:37 AMsdeleuze
10/06/2017, 8:48 AMnull
when returning T?
and throw an exception when returning T
, see also this documentation PR just created about this topic https://github.com/spring-projects/spring-data-commons/pull/253/commits/1f126600767afae33eb470010bb1c6bf4929cfadsdeleuze
10/06/2017, 8:49 AMveiset
10/06/2017, 8:52 AMsdeleuze
10/06/2017, 10:08 AMveiset
10/06/2017, 10:37 AMsdeleuze
10/06/2017, 10:38 AM