package Ġcom . example . demo . services Ċ Ċ import Ġcom . example . demo . entities . booking . Booking Ċ import Ġcom . example . demo . repositories . Booking Repository Ċ import Ġorg . springframework . dao . Empty Result Data AccessException Ċ import Ġorg . springframework . stereotype . Service Ċ Ċ @ Service Ċ class ĠBook ing Service ( val Ġdb : ĠBook ing Repository ) Ġ{ ĊĊĠĠĠ Ġfun ĠfindAll Book ings (): ĠList < Booking > Ġ= Ġdb . findAll () ĊĊĠĠĠ Ġfun Ġfind Booking ById ( id : ĠLong ): ĠBook ing Ġ= ĊĠĠĠĠĠĠĠ Ġ// Ġsimilar Ġbehavior Ġas Ġwhen Ġinvoking Ġdb . delete ById (...) ĊĠĠĠĠĠĠĠ Ġdb . findById ( id ). orElse Throw Ġ{ ĠEmpty Result Data AccessException ( 1 ) Ġ} ĊĊĠĠĠ Ġfun Ġcreate Booking ( booking : ĠBook ing ): ĠBook ing Ġ= Ġdb . save ( booking ) ĊĊĠĠĠ Ġfun Ġupdate Booking ( booking : ĠBook ing ): ĠBook ing Ġ= Ġdb . save ( booking ) ĊĊĠĠĠ Ġfun Ġdelete Booking ById ( id : ĠLong ) Ġ= Ġdb . delete ById ( id ) Ċ } Ċ