diff --git a/querydsl-postgrest-resttemplate-adapter/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRestTemplate.java b/querydsl-postgrest-resttemplate-adapter/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRestTemplate.java index 107342e..4a8dfb6 100644 --- a/querydsl-postgrest-resttemplate-adapter/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRestTemplate.java +++ b/querydsl-postgrest-resttemplate-adapter/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRestTemplate.java @@ -131,5 +131,4 @@ private URI getUri(String resource, Map> params) { return uriBuilder.build().encode().toUri(); } - } diff --git a/querydsl-postgrest/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRepository.java b/querydsl-postgrest/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRepository.java index f3c251c..592cbdc 100644 --- a/querydsl-postgrest/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRepository.java +++ b/querydsl-postgrest/src/main/java/fr/ouestfrance/querydsl/postgrest/PostgrestRepository.java @@ -133,11 +133,11 @@ public BulkResponse upsert(List values, BulkOptions options) { * @return map of query params for on conflict if annotation OnConflict is present otherwise empty map */ private Map> getUpsertQueryParams() { - return Optional.ofNullable(this.getClass().getAnnotation(OnConflict.class)) - .map(OnConflict::columnNames) - .map(Arrays::asList) - .map(onConflictList-> Map.of(ON_CONFLICT_QUERY_PARAMS, onConflictList)) - .orElse(Map.of()); + OnConflict onConflict = this.getClass().getAnnotation(OnConflict.class); + if (Objects.nonNull(onConflict)) { + return Map.of(ON_CONFLICT_QUERY_PARAMS, List.of(String.join(",", onConflict.columnNames()))); + } + return Collections.emptyMap(); } /**