@@ -245,13 +245,19 @@ private static void ensureSkiplistIndex(final CollectionOperations collection,
245
245
246
246
private static void ensurePersistentIndex (final CollectionOperations collection , final PersistentIndex annotation ) {
247
247
collection .ensurePersistentIndex (Arrays .asList (annotation .fields ()),
248
- new PersistentIndexOptions ().unique (annotation .unique ()).sparse (annotation .sparse ()));
248
+ new PersistentIndexOptions ()
249
+ .unique (annotation .unique ())
250
+ .sparse (annotation .sparse ())
251
+ .deduplicate (annotation .deduplicate ()));
249
252
}
250
253
251
254
private static void ensurePersistentIndex (final CollectionOperations collection ,
252
255
final ArangoPersistentProperty value ) {
253
256
final PersistentIndexOptions options = new PersistentIndexOptions ();
254
- value .getPersistentIndexed ().ifPresent (i -> options .unique (i .unique ()).sparse (i .sparse ()));
257
+ value .getPersistentIndexed ().ifPresent (i -> options
258
+ .unique (i .unique ())
259
+ .sparse (i .sparse ())
260
+ .deduplicate (i .deduplicate ()));
255
261
collection .ensurePersistentIndex (Collections .singleton (value .getFieldName ()), options );
256
262
}
257
263
@@ -684,7 +690,8 @@ public <T> void upsert(final Iterable<T> value, final UpsertStrategy strategy) t
684
690
685
691
@ Override
686
692
public <T > void repsert (final T value ) throws DataAccessException {
687
- @ SuppressWarnings ("unchecked" ) final Class <T > clazz = (Class <T >) value .getClass ();
693
+ @ SuppressWarnings ("unchecked" )
694
+ final Class <T > clazz = (Class <T >) value .getClass ();
688
695
final String collectionName = _collection (clazz ).name ();
689
696
690
697
potentiallyEmitEvent (new BeforeSaveEvent <>(value ));
@@ -697,8 +704,7 @@ public <T> void repsert(final T value) throws DataAccessException {
697
704
.put ("@col" , collectionName )
698
705
.put ("doc" , value )
699
706
.get (),
700
- clazz
701
- ).first ();
707
+ clazz ).first ();
702
708
} catch (final ArangoDBException e ) {
703
709
throw exceptionTranslator .translateExceptionIfPossible (e );
704
710
}
@@ -724,8 +730,7 @@ public <T> void repsert(final Iterable<? extends T> values, final Class<T> entit
724
730
.put ("@col" , collectionName )
725
731
.put ("docs" , values )
726
732
.get (),
727
- entityClass
728
- ).asListRemaining ();
733
+ entityClass ).asListRemaining ();
729
734
} catch (final ArangoDBException e ) {
730
735
throw translateExceptionIfPossible (e );
731
736
}
@@ -743,13 +748,15 @@ private void updateDBFieldsFromObjects(final Iterable<?> values, final Iterable<
743
748
}
744
749
745
750
private void updateDBFieldsFromObject (final Object toModify , final Object toRead ) {
746
- final ArangoPersistentEntity <?> entityToRead = converter .getMappingContext ().getPersistentEntity (toRead .getClass ());
751
+ final ArangoPersistentEntity <?> entityToRead = converter .getMappingContext ()
752
+ .getPersistentEntity (toRead .getClass ());
747
753
final PersistentPropertyAccessor <?> accessorToRead = entityToRead .getPropertyAccessor (toRead );
748
754
final ArangoPersistentProperty idPropertyToRead = entityToRead .getIdProperty ();
749
755
final Optional <ArangoPersistentProperty > arangoIdPropertyToReadOptional = entityToRead .getArangoIdProperty ();
750
756
final Optional <ArangoPersistentProperty > revPropertyToReadOptional = entityToRead .getRevProperty ();
751
757
752
- final ArangoPersistentEntity <?> entityToModify = converter .getMappingContext ().getPersistentEntity (toModify .getClass ());
758
+ final ArangoPersistentEntity <?> entityToModify = converter .getMappingContext ()
759
+ .getPersistentEntity (toModify .getClass ());
753
760
final PersistentPropertyAccessor <?> accessorToWrite = entityToModify .getPropertyAccessor (toModify );
754
761
final ArangoPersistentProperty idPropertyToWrite = entityToModify .getIdProperty ();
755
762
@@ -760,7 +767,8 @@ private void updateDBFieldsFromObject(final Object toModify, final Object toRead
760
767
if (arangoIdPropertyToReadOptional .isPresent ()) {
761
768
ArangoPersistentProperty arangoIdPropertyToRead = arangoIdPropertyToReadOptional .get ();
762
769
entityToModify .getArangoIdProperty ().filter (arangoId -> !arangoId .isImmutable ())
763
- .ifPresent (arangoId -> accessorToWrite .setProperty (arangoId , accessorToRead .getProperty (arangoIdPropertyToRead )));
770
+ .ifPresent (arangoId -> accessorToWrite .setProperty (arangoId ,
771
+ accessorToRead .getProperty (arangoIdPropertyToRead )));
764
772
}
765
773
766
774
if (revPropertyToReadOptional .isPresent ()) {
0 commit comments