@@ -670,6 +670,70 @@ public void testQueryGetResultCountWithMutiny(VertxTestContext context) {
670
670
);
671
671
}
672
672
673
+ @ Test
674
+ public void testNativeSelectionQueryGetResultCountWithStage (VertxTestContext context ) {
675
+ Author author1 = new Author ( "Iain M. Banks" );
676
+ Author author2 = new Author ( "Neal Stephenson" );
677
+ test ( context , getSessionFactory ()
678
+ .withTransaction ( s -> s .persist ( author1 , author2 ) )
679
+ .thenCompose ( v -> getSessionFactory ().withSession ( s -> s
680
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
681
+ .getResultCount () ) )
682
+ .thenAccept ( count -> assertEquals ( 2L , count ) )
683
+ );
684
+ }
685
+
686
+ @ Test
687
+ public void testNativeQueryGetResultCountWithStage (VertxTestContext context ) {
688
+ Author author1 = new Author ( "Iain M. Banks" );
689
+ Author author2 = new Author ( "Neal Stephenson" );
690
+ test ( context , getSessionFactory ()
691
+ .withTransaction ( s -> s .persist ( author1 , author2 ) )
692
+ .thenCompose ( v -> getSessionFactory ().withSession ( s -> s
693
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
694
+ .getResultCount () ) )
695
+ .thenAccept ( count -> assertEquals ( 2L , count ) )
696
+ .thenCompose ( v -> getSessionFactory ().withSession ( s -> s
697
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
698
+ .setMaxResults ( 1 )
699
+ .setFirstResult ( 1 )
700
+ .getResultCount () ) )
701
+ .thenAccept ( count -> assertEquals ( 2L , count ) )
702
+ );
703
+ }
704
+
705
+ @ Test
706
+ public void testNativeSelectionQueryGetResultCountWithMutiny (VertxTestContext context ) {
707
+ Author author1 = new Author ( "Iain M. Banks" );
708
+ Author author2 = new Author ( "Neal Stephenson" );
709
+ test ( context , getSessionFactory ()
710
+ .withTransaction ( s -> s .persist ( author1 , author2 ) )
711
+ .thenCompose ( v -> getSessionFactory ().withSession ( s -> s
712
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
713
+ .getResultCount () ) )
714
+ .thenAccept ( count -> assertEquals ( 2L , count ) )
715
+ );
716
+ }
717
+
718
+ @ Test
719
+ public void testNativeQueryGetResultCountWithMutiny (VertxTestContext context ) {
720
+ Author author1 = new Author ( "Iain M. Banks" );
721
+ Author author2 = new Author ( "Neal Stephenson" );
722
+ test ( context , getMutinySessionFactory ()
723
+ .withTransaction ( s -> s .persistAll ( author1 , author2 ) )
724
+ .chain ( () -> getMutinySessionFactory ().withSession ( s -> s
725
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
726
+ .getResultCount () ) )
727
+ .invoke ( count -> assertEquals ( 2L , count ) )
728
+ .chain ( () -> getMutinySessionFactory ().withSession ( s -> s
729
+ .createNativeQuery ( "select * from " + AUTHOR_TABLE , Author .class )
730
+ .setMaxResults ( 1 )
731
+ .setFirstResult ( 1 )
732
+ .getResultCount () ) )
733
+ .invoke ( count -> assertEquals ( 2L , count ) )
734
+ );
735
+ }
736
+
673
737
@ NamedNativeQuery (
674
738
name = SQL_NAMED_QUERY ,
675
739
resultClass = Object [].class ,
0 commit comments