package Ġnet . tim afe . ang kor . repo Ċ Ċ import Ġnet . tim afe . ang kor . domain . Loc atable Entity Ċ import Ġnet . tim afe . ang kor . domain . Video Ċ import Ġnet . tim afe . ang kor . domain . enums . Auth Scope Ċ import Ġnet . tim afe . ang kor . repo . interfaces . Auth Scope Support Ċ import Ġorg . springframework . data . jpa . repository . Query Ċ import Ġorg . springframework . data . repository . Crud Repository Ċ import Ġorg . springframework . data . repository . query . Param Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* ĠCr ud ĠOperations Ġfor ĠV ideos Ċ Ġ* ĠFor Ġcomplex ĠS ear ches , Ġuse ĠLocation Search Ċ Ġ*/ Ċ interface ĠLocation Repository Ġ: ĠCr ud Repository < Loc atable Entity , ĠUUID >, ĠAuth Scope Support < Loc atable Entity > Ġ{ ĊĊĠĠĠ Ġ// Ġfun Ġfind One By External Id ( external Id : ĠString ): ĠOptional < Video > ĊĊĠĠĠ Ġ@ Query ( ĊĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ ĠSELECT ĠCOUNT (*) ĠFROM ĠLocation ĊĠĠĠĠĠĠĠ ĠWHERE Ġcoordinates Ġ!= Ġ'{}' ĠAND Ġauth _ scope = ANY Ġ( cast (: auth Scopes Ġas Ġauth _ scope [] )) ĊĠĠĠĠĠĠĠ Ġ"" ", Ġnative Query Ġ= Ġtrue ĊĠĠĠ Ġ) ĊĠĠĠ Ġfun Ġitems With Coordinates Count (@ Param (" auth Scopes ") Ġauth Scopes : ĠString ): ĠLong ĊĊĠĠĠ Ġ// Ġquery Ġby Ġauth scope Ġshould Ġalso Ġwork Ġwith Ġnone - native Ġqueries : ĊĠĠĠ Ġ@ Query (" SELECT Ġl ĠFROM ĠLoc atable Entity Ġl ĠWHERE Ġl . auth Scope ĠIN Ġ(: auth Scopes )") ĊĠĠĠ Ġoverride Ġfun ĠfindAll (@ Param (" auth Scopes ") Ġauth Scopes : ĠList < Auth Scope >): ĠList < Video > ĊĊĠĠĠ Ġ// ĠQuery Ġby Ġtype Ġhttps :// stackoverflow . com / a / 4 8 8 4 3 5 1 / 4 2 9 2 0 7 5 ĊĠĠĠ Ġ// ĠSome Ġmissing Ġinformation : Ġ" TYPE " Ġis Ġa Ġ" JP QL ĠSpecial ĠOperator " Ġtaking Ġin Ġargument ĊĠĠĠ Ġ// Ġelement Ġname Ġ( l ), Ġand Ġmay Ġbe Ġcompared Ġto Ġthe Ġsimple Ġclass Ġname ĊĠĠĠ Ġ// Ġhttps :// www . logic big . com / tutorials / java - ee - tutorial / jpa / jp ql - pol ymorphic - queries . html ĊĠĠĠ Ġ@ Query (" SELECT Ġcount ( l ) ĠFROM ĠLoc atable Entity Ġl ĠWHERE ĠTYPE ( l ) ĠIN Ġ(: types ) ĠAND Ġl . auth Scope ĠIN Ġ(: auth Scopes )") ĊĠĠĠ Ġfun Ġitem Count By Types ( ĊĠĠĠĠĠĠĠ Ġ@ Param (" types ") Ġentity Classes : ĠList < Class < out ĠLoc atable Entity >>, ĊĠĠĠĠĠĠĠ Ġ@ Param (" auth Scopes ") Ġauth Scopes : ĠList < Auth Scope > ĊĠĠĠ Ġ): ĠLong Ċ Ċ } Ċ