? ????? Spring Data JPA ???????? ??? UUID ?? ??? ???? Map
???? ???? ? ??
?? ???? ?? UUID ??? ???? ??? UUID? ?????? ???(?: YourEntityHere)? ?? ??(?: serviceId)? ????? ???? ?? ??? ?? ????. ????? ??? ??? Map
?????? ???? ??? SQL ??? ?? ?? ? ?? ??? ???? ?? ?? ???? ??? ?? ??? ????? ?? ?????? ????? ??? ??? ?? ????. ??? Spring Data JPA? Java ???? API? ??? ??? ???? ?????.
?? ?? ??
???, ??, ?? ?? ???? ??? ???? ? ????? ? ??? ??? ?? ????.
- ?????? ?? ???: ??????? ??? ???? UUID? ?????.
- ?????? ??? ??: ?? ??? ???? Java ???? API? ???? ?? Map
? ?????.
? ?? ??? ?????? ??? ???? ????? ???? ??? ?? ??? ?????? ????? ???? Java? ??? ??? ?? ??? ??? ?????.
1. JPA ????? ??: ?? UUID ??
Spring Data JPA ????? ???????? @Query ??? ???? ????? ?? UUID ??? ???? ??? ID? ????? ??? ?? ??? ??? ? ????.
??? ??? ???? YourEntityHere?? ? ?? id ??(?? serviceId? ?? ?????? UUID ??)? ??? ??? ?????.
org.springframework.data.jpa.repository.JpaRepository ????; org.springframework.data.jpa.repository.Query? ?????. org.springframework.data.repository.query.Param ????; java.util.List ????; java.util.UUID ????; ?? ????? YourEntityHereRepository? JpaRepository<yourentityhere uuid>? ?????. /** * ??? UUID ??? ???? ??????? ??? ???? UUID? ?????. * * @param uuid ??? UUID ?????. * @return ??????? ???? UUID ?????. */ @Query("YourEntityHere?? yeh.id? ????? yeh WHERE yeh.id IN :uuids") List<uuid> findExistingServiceUuids(@Param("uuid") List<uuid> uuids); }</uuid></uuid></yourentityhere>
?? ??:
- @Query("SELECT yeh.id FROM YourEntityHere yeh WHERE yeh.id IN :uuids"): ?? YourEntityHere ????? ?? id ?? ?? ???? JPQL ?????. ?, ??? id ?? ???? :uuids ???? ??? ???? ??? ???.
- @Param("uuids"): ??? ???? uuid? JPQL ??? ??? ????(uuid)? ????? ? ?????.
2. ??? ??: UUID ? ?? ?? ??
??? ??(?? ?????? ???? ?? ???? ?? ??)?? ?? ????? ???? ???? ?? UUID ??? ??? ?? Java 8? ???? API? ???? ?? Map
org.springframework.stereotype.Service ????; java.util.List ????; java.util.Map ????; java.util.UUID ????; import java.util.function.Function; import java.util.stream.Collectors; @??? ?? ??? YourService { ??? ?? YourEntityHereRepository ???; ?? YourService(YourEntityHereRepository ???) { this.repository = ???; } /** * ??? UUID ??? ???? UUID? ?? ??? ??? ?????. * * @param uuid ??? UUID ?????. * @return ?, ?? UUID, ?? ?????(true? ???? ???? false? ???? ??? ???). */ ?? ?<uuid boolean> getUuidExistenceMap(List<uuid> uuid) { // 1. ???????? ?? ?? UUID? ?????. List<uuid>foundUuids = repository.findExistingServiceUuids(uuid); // 2. Java ???? API? ???? ?? ?? // ?? ??? ? UUID? ?? FoundUuids? ??? ?? return uuids.stream() .collect(???.toMap( Function.identity(), // ?: UUID ??foundUuids::contains // ?: UUID?foundUuids ??? ??? ??)); } }</uuid></uuid></uuid>
?? ??:
- ???.findExistingServiceUuids(uuid): ???????? ??? ?? UUID? ???? ??? ???? ??????.
- uuids.stream().collect(Collectors.toMap(...)): ?? ??? ?????.
- Function.identity(): ?? ?? ???? ?? ??(?, ?? uuid ??? ? UUID)?? ?????.
- foundUuids::contains: ??? Map? ?? ?? UUID?foundUuids ??? ????? ??? ???? ?? ??????. List.contains() ???? ??? ??? ????? ???? true ?? false? ?????.
?? ? ?? ?? ??
-
List.contains()? ??: List.contains() ???? ????? ?????? ?? ??(O(n))???. foundUuids ??? ?? ? ?? ??? ??? ?? ? ????. ? ??,foundUuids? HashSet?? ???? HashSet.contains()? ?? ?? ???? O(1)? ??? ???? Map ?? ???? ???? ? ????.
// ???: ?? ???? ??? ??foundUuids? HashSet?? ?? Set<uuid>foundUuidsSet = new HashSet(repository.findExistingServiceUuids(uuids)); uuid.stream()? ?????. .collect(???.toMap( ??.identity(), foundUuidsSet::contains // O(1) ??? HashSet ??));</uuid>
?? ??? ???: ?????? ? ??? ?????? ??(?: LEFT JOIN ? CASE ? ??)? ?? ?????? ???? ?? Map
? ??? ???? ????? ??? ? ????. ??? ??? ??? ??? ??? ????? ??? ?? ?????? ??? ???? ??? ????. ??? ?? ?? ??? ?? ??? ?? ? ?? ??? ???? ?? ? ?? ??? ????.
??
Spring Data JPA? @Query ??? Java 8? ???? API? ?????? UUID ???? ?????? ?? ???? ?? ??? ???? ????? ??? ? ????. ? 2?? ??? ?? ???? ?? ???? ??? ?? ??? ??? ?? ??? ?? ???(?: HashSet ??)? ?? ??? ?? ???? ?? ????. ??? ???? ????? ???? ? ???? ?????.
? ??? Spring Data JPA? ???? UUID ? ?? ?? ??? ????? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Stock Market GPT
? ??? ??? ?? AI ?? ?? ??

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

-CP ?? ??? ???? JVM? ClassPath? ???? JAVA -Clibrary.jarcom.example.Main? ?? ?? ??? ? ?????? ? ? ???, ?? ???? ?? ???? ?? ? ?? ???? ???? ??? ?? ?? ?? ?? Manifest.MF? ?? ?? ? ? ????.

usefile.createnewfile () to reatefileonlyifitdoesn'texist, ???;

Javaspi? JDK? ?? ??? ?? ?????? Serviceloader? ?? ????? ?? ?? ??? ?????. 1. ??? ?????? ???? Meta-Inf/Services/?? ?????? ?? ??? ?? ??? ???? ?? ???? ??? ? ??? ??????. 2. serviceloader.load ()? ???? ?? ???????? JVM? ???? ??? ?? ????????. 3. ????? ??? ?? ?? ?? ??? ?? ?? ? ?????? ???? ?? ??? ???????. 4. ?? ???? ?????? ?? ?? ?? ??? ? ???? ??? ?????. 5. ??, ??? ??, ?? ??, ??? ?? ? ?? ??????????. 6. Java9??? ?? ???? ?? ?? ? ? ????.

Amplements ???? ???? ?????? ??????. ? ???? ??????? ?? ???? ?? ??? ???????. ?? ?????? ???? ???? ????? ??? ?????. Java 8 ??? ?? ? ?? ???? ?? ??? ??? ????.

javagenericsprovidecompile-timetypesafetyandeliminatecastingtypeparametersonclasses, interfaces, methods; wildcards (?,? extendStype,? supertype) handlUnknowntypeswithflexible.1.useUnunUnunUndwildCardWhentyPeiLISIRVENTERREATHERNEATHEATHEATHEATHEATHEATHEATHEATHEATHEARVENTOUBERDERRELOUNTERRELONTERREATHEARBERBERBENTECASTS;

? ????? ??? TCP ??, ? HTTP ?? ?? (Keep-Alive)?? ?? HTTP ??? ???? ????? ????? ?? ???. ? ??? HTTP/1.X? HTTP/2 ????? ??? ????? ???? ??? ?? ?? ? ??? ???? ??? ???? ???? ?? : ?? ??? ???? ???? ??? ?????. ???? ??? ???? ?? ??? ?????? ???? ????? ??? HTTP ?????? ?? ? ? ??? ?????.

? ????? Java? ?? ?? ??? ???? ?? ? ?? ??? ????? ???? ?? ?? ??? ?? ??? ???? ??? ??? ?????. ? ??? Java 8 Stream API? FlatMap ??? ?? ? ?? ?? ???? ?????. ? ??? ???? ??? ?? ??? ??? ?? ????? ??? ????? ?? ??? ??? ?? ?????.

??? thread.currentThread ()? ???? ?? ??? ??? ?? ??? 2? ?? ?? ???? SOMEMETHOD ??? ?? ????. ?? 0? getStackTrace?? ??? 1? ?????, 2? ????? ???, ?? ??? "Bymethod : Somemethod"?? ?? ? ???, ??? ?? ?? ? ? ????.
