@@ -436,7 +436,8 @@ public <T> ListenableFuture<List<T>> select(Query query, Class<T> entityClass) t
436
436
Assert .notNull (query , "Query must not be null" );
437
437
Assert .notNull (entityClass , "Entity type must not be null" );
438
438
439
- return select (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass )).build (), entityClass );
439
+ return select (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass ))
440
+ .build (), entityClass );
440
441
}
441
442
442
443
/* (non-Javadoc)
@@ -450,7 +451,8 @@ public <T> ListenableFuture<Void> select(Query query, Consumer<T> entityConsumer
450
451
Assert .notNull (entityConsumer , "Entity Consumer must not be empty" );
451
452
Assert .notNull (entityClass , "Entity type must not be null" );
452
453
453
- return select (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass )).build (), entityConsumer ,
454
+ return select (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass ))
455
+ .build (), entityConsumer ,
454
456
entityClass );
455
457
}
456
458
@@ -463,7 +465,8 @@ public <T> ListenableFuture<T> selectOne(Query query, Class<T> entityClass) thro
463
465
Assert .notNull (query , "Query must not be null" );
464
466
Assert .notNull (entityClass , "Entity type must not be null" );
465
467
466
- return selectOne (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass )).build (),
468
+ return selectOne (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass ))
469
+ .build (),
467
470
entityClass );
468
471
}
469
472
@@ -476,7 +479,8 @@ public <T> ListenableFuture<Slice<T>> slice(Query query, Class<T> entityClass) t
476
479
Assert .notNull (query , "Query must not be null" );
477
480
Assert .notNull (entityClass , "Entity type must not be null" );
478
481
479
- return slice (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass )).build (), entityClass );
482
+ return slice (getStatementFactory ().select (query , getRequiredPersistentEntity (entityClass ))
483
+ .build (), entityClass );
480
484
}
481
485
482
486
/* (non-Javadoc)
@@ -490,7 +494,8 @@ public ListenableFuture<Boolean> update(Query query, org.springframework.data.ca
490
494
Assert .notNull (update , "Update must not be null" );
491
495
Assert .notNull (entityClass , "Entity type must not be null" );
492
496
493
- return doExecute (getStatementFactory ().update (query , update , getRequiredPersistentEntity (entityClass )).build (),
497
+ return doExecute (getStatementFactory ().update (query , update , getRequiredPersistentEntity (entityClass ))
498
+ .build (),
494
499
AsyncResultSet ::wasApplied );
495
500
}
496
501
@@ -516,7 +521,8 @@ private ListenableFuture<Boolean> doDelete(Query query, Class<?> entityClass, Cq
516
521
517
522
ListenableFuture <Boolean > future = doExecute (delete , AsyncResultSet ::wasApplied );
518
523
519
- future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(delete , entityClass , tableName )), e -> {});
524
+ future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(delete , entityClass , tableName )), e -> {
525
+ });
520
526
521
527
return future ;
522
528
}
@@ -559,7 +565,8 @@ ListenableFuture<Long> doCount(Query query, Class<?> entityClass, CqlIdentifier
559
565
560
566
SingleColumnRowMapper <Long > mapper = SingleColumnRowMapper .newInstance (Long .class );
561
567
562
- Row row = DataAccessUtils .requiredSingleResult (Streamable .of (it .currentPage ()).toList ());
568
+ Row row = DataAccessUtils .requiredSingleResult (Streamable .of (it .currentPage ())
569
+ .toList ());
563
570
return mapper .mapRow (row , 0 );
564
571
});
565
572
@@ -642,7 +649,7 @@ private <T> ListenableFuture<EntityWriteResult<T>> doInsert(T entity, WriteOptio
642
649
getConverter ().getConversionService ());
643
650
CassandraPersistentEntity <?> persistentEntity = getRequiredPersistentEntity (entity .getClass ());
644
651
645
- T entityToUse = source .isVersionedEntity () ? source .initializeVersionProperty () : entity ;
652
+ T entityToUse = source .isVersionedEntity () ? source .initializeVersionProperty () : source . getBean () ;
646
653
647
654
StatementBuilder <RegularInsert > builder = getStatementFactory ().insert (entityToUse , options , persistentEntity ,
648
655
tableName );
@@ -762,7 +769,8 @@ private ListenableFuture<WriteResult> doDeleteVersioned(Object entity, QueryOpti
762
769
StatementBuilder <Delete > delete = getStatementFactory ().delete (entity , options , getConverter (), tableName );
763
770
;
764
771
765
- return executeDelete (entity , tableName , source .appendVersionCondition (delete ).build (), result -> {
772
+ return executeDelete (entity , tableName , source .appendVersionCondition (delete )
773
+ .build (), result -> {
766
774
767
775
if (!result .wasApplied ()) {
768
776
throw new OptimisticLockingFailureException (
@@ -776,7 +784,8 @@ private ListenableFuture<WriteResult> doDelete(Object entity, QueryOptions optio
776
784
777
785
StatementBuilder <Delete > delete = getStatementFactory ().delete (entity , options , getConverter (), tableName );
778
786
779
- return executeDelete (entity , tableName , delete .build (), result -> {});
787
+ return executeDelete (entity , tableName , delete .build (), result -> {
788
+ });
780
789
}
781
790
782
791
/* (non-Javadoc)
@@ -797,7 +806,8 @@ public ListenableFuture<Boolean> deleteById(Object id, Class<?> entityClass) {
797
806
maybeEmitEvent (new BeforeDeleteEvent <>(delete , entityClass , tableName ));
798
807
799
808
ListenableFuture <Boolean > future = doExecute (delete , AsyncResultSet ::wasApplied );
800
- future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(delete , entityClass , tableName )), e -> {});
809
+ future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(delete , entityClass , tableName )), e -> {
810
+ });
801
811
802
812
return future ;
803
813
}
@@ -817,7 +827,8 @@ public ListenableFuture<Void> truncate(Class<?> entityClass) {
817
827
maybeEmitEvent (new BeforeDeleteEvent <>(statement , entityClass , tableName ));
818
828
819
829
ListenableFuture <Boolean > future = doExecute (statement , AsyncResultSet ::wasApplied );
820
- future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(statement , entityClass , tableName )), e -> {});
830
+ future .addCallback (success -> maybeEmitEvent (new AfterDeleteEvent <>(statement , entityClass , tableName )), e -> {
831
+ });
821
832
822
833
return new MappingListenableFutureAdapter <>(future , aBoolean -> null );
823
834
}
@@ -842,7 +853,8 @@ protected AsyncPreparedStatementHandler createPreparedStatementHandler(Statement
842
853
private <T > ListenableFuture <EntityWriteResult <T >> executeSave (T entity , CqlIdentifier tableName ,
843
854
SimpleStatement statement ) {
844
855
845
- return executeSave (entity , tableName , statement , ignore -> {});
856
+ return executeSave (entity , tableName , statement , ignore -> {
857
+ });
846
858
}
847
859
848
860
private <T > ListenableFuture <EntityWriteResult <T >> executeSave (T entity , CqlIdentifier tableName ,
@@ -926,11 +938,13 @@ private <T> ListenableFuture<T> doExecute(Statement<?> statement, Function<Async
926
938
}
927
939
928
940
private static List <Row > getFirstPage (AsyncResultSet resultSet ) {
929
- return StreamSupport .stream (resultSet .currentPage ().spliterator (), false ).collect (Collectors .toList ());
941
+ return StreamSupport .stream (resultSet .currentPage ().spliterator (), false )
942
+ .collect (Collectors .toList ());
930
943
}
931
944
932
945
private static int getConfiguredPageSize (CqlSession session ) {
933
- return session .getContext ().getConfig ().getDefaultProfile ().getInt (DefaultDriverOption .REQUEST_PAGE_SIZE , 5000 );
946
+ return session .getContext ().getConfig ().getDefaultProfile ()
947
+ .getInt (DefaultDriverOption .REQUEST_PAGE_SIZE , 5000 );
934
948
}
935
949
936
950
private int getEffectivePageSize (Statement <?> statement ) {
0 commit comments