0
J'ai essayé:Jpa ou gestionnaire d'entités traitent la liste des paramètres: Liste <Long>
@Query("Select m.id from Cars m where m.id not in :x")
List<Long> findNotChoosenCars(@Param("x") List<Long> CarsId);
Je reçois:
org.postgresql.util.PSQLException: ERREUR: erreur de syntaxe sur ou près de «) »
Translation: syntax error near <<) >>
J'ai aussi essayé de mettre: x entre parenthèses comme: (: x)
J'ai aussi essayé
@Query(value = "Select id from Cars where id not in (?1)",nativeQuery = true)
List<Long> findNotChoosenCars(List<Long> CarsId);
Et aussi:
private EntityManagerFactory emf;
private List<Long> getNotSelectedCarsIds(List<Long> selectedIds){
List<String>strings=selectedIds.stream().map(Object::toString).collect(Collectors.toList());
final String notSelectedCarIdsSql= "Select id from Car where id not in (:strings)";
return emf.createEntityManager().createNativeQuery(notSelectedMarkerIdsSql)
.setParameter("strings",strings)
.getResultList();
}
J'ai toujours le même stacktrace. J'utilise postgres 9.4 Toute aide s'il vous plaît?
Vous aviez raison. Je pensais que si null la valeur retournée serait nulle. Je ne m'attendais pas à un échec .. Merci. – John