package Ġpers . ac p . test . kotlin . domain Ċ Ċ import Ġpers . ac p . test . kotlin . entity . Table One Ċ import Ġpers . ac p . test . kotlin . entity . Table Two Ċ import Ġpers . ac p . test . kotlin . repository . Member Two Repository Ċ import Ġpers . ac p . test . kotlin . repository . Table One Repository Ċ import Ġpers . ac p . test . kotlin . repository . Table Two Repository Ċ import Ġorg . springframework . data . jpa . domain . Specification Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġorg . springframework . transaction . annotation . Transactional Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* Ġ@ author Ġz hang bin Ġby Ġ 2 8 / 0 4 / 2 0 1 8 Ġ 1 3 : 0 7 Ċ Ġ* Ġ@ since ĠJDK Ġ 1 1 Ċ Ġ*/ Ċ @ Service Ċ @ Transactional ( readOnly Ġ= Ġtrue ) Ċ class ĠTable One Domain ( private Ġval Ġtable One Repository : ĠTable One Repository , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġtable Two Repository : ĠTable Two Repository , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġmember Two Repository : ĠMember Two Repository ) Ġ{ ĊĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġcreate ( table One : ĠTable One ): ĠTable One Ġ= Ġtable One Repository . save ( table One ) ĊĊĠĠĠ Ġfun Ġquery ( name : ĠString ): ĠOptional < Table One > Ġ= Ġtable One Repository . find ByName ( name ) ĊĊĠĠĠ Ġfun Ġall ( specification : ĠSpecification < Table One >? ): ĠMutable List < Table One > Ġ= Ġtable One Repository . findAll ( specification ) ĊĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġtest Delete Two ( name : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġmember Two Repository . delete All ByName ( name ) ĊĠĠĠĠĠĠĠ Ġtable Two Repository . delete All ByName ( name ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Transactional ĊĠĠĠ Ġfun Ġtest Save Two ( table Two : ĠTable Two ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtable Two Repository . save ( table Two ) ĊĠĠĠ Ġ} Ċ }