Код: Выделить всё
@Transactional(readOnly = true)
public UtenteDTO getUtenteFromAsta(
String nomeGiocatore, String tempoInizio
) throws PlayerNotFoundException, UserNotFoundException, ParseException {
Giocatore giocatore = giocatoreService.getGiocatoreByNome(nomeGiocatore);
Date data = df.parse(tempoInizio);
LocalDateTime ldt = data.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
Optional u = astaRepository.getUtenteFromAstaByGiocatore(giocatore, ldt);
if (u.isEmpty())
throw new UserNotFoundException();
Utente utente = u.get();
UtenteDTO uDTO = new UtenteDTO();
uDTO.setEmail(utente.getEmail());
uDTO.setNome(utente.getNome());
uDTO.setCognome(utente.getCognome());
uDTO.setRuolo(false);
return uDTO;
}
Это запрос: < /p>
@Query("SELECT ua.utente FROM Asta a, UtenteAsta ua WHERE a.id = ua.id.astaId AND a.giocatore_nome = ?1 AND a.tempo_inizio = ?2")
Optional getUtenteFromAstaByGiocatore(Giocatore giocatore, LocalDateTime tempoInizio);
< /code>
этот подход правильный, или я что -то упускаю? с передней части, а также хранится в DB: < /p>
2025-01-29 15: 09: 57.475000 < /p>
< /blockquote>
Подробнее здесь: https://stackoverflow.com/questions/793 ... t-timezone