Skip to content

Commit fbd32af

Browse files
committed
Fi
1 parent 9f0a47c commit fbd32af

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/sql/results/internal/ReactiveDeferredResultSetAccess.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ private JdbcSessionContext context() {
150150
}
151151

152152
private CompletionStage<ResultSet> executeQuery() {
153-
final LogicalConnectionImplementor logicalConnection = getPersistenceContext().getJdbcCoordinator()
154-
.getLogicalConnection();
153+
final LogicalConnectionImplementor logicalConnection = getPersistenceContext()
154+
.getJdbcCoordinator().getLogicalConnection();
155155
return completedFuture( logicalConnection )
156156
.thenCompose( lg -> {
157157
LOG.tracef( "Executing query to retrieve ResultSet : %s", getFinalSql() );
@@ -182,6 +182,7 @@ private CompletionStage<ResultSet> executeQuery() {
182182
: handler.getResultAsCompletionStage()
183183
);
184184
} )
185+
// same as a finally block
185186
.whenComplete( (o, throwable) -> logicalConnection.afterStatement() );
186187
}
187188

hibernate-reactive-core/src/test/java/org/hibernate/reactive/BaseReactiveTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ protected void addEntities(Configuration configuration) {
169169
* This method works for most common cases, but some tests might need to overrides it
170170
*/
171171
public CompletionStage<Void> deleteEntities(Class<?>... entities) {
172+
System.out.println( "Deleting rows in the tables" );
172173
return getSessionFactory()
173174
.withTransaction( s -> loop( entities, entityClass -> s
174175
.createQuery( queryForDelete( entityClass ) )
@@ -275,6 +276,7 @@ public void release() {
275276

276277
@AfterEach
277278
public void after(VertxTestContext context) {
279+
System.out.println( "-- Test finished, closing session and cleaning the database" );
278280
test( context, closeSession( session )
279281
.thenAccept( v -> session = null )
280282
.thenCompose( v -> closeSession( statelessSession ) )

hibernate-reactive-core/src/test/java/org/hibernate/reactive/containers/MSSQLServerDatabase.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ class MSSQLServerDatabase implements TestableDatabase {
7777
expectedDBTypeForClass.put( BigDecimal.class, "numeric" );
7878
expectedDBTypeForClass.put( Serializable.class, "varbinary" );
7979
expectedDBTypeForClass.put( UUID.class, "binary" );
80-
expectedDBTypeForClass.put( Instant.class, "datetime2" );
80+
expectedDBTypeForClass.put( Instant.class, "datetimeoffset" );
8181
expectedDBTypeForClass.put( Duration.class, "bigint" );
8282
expectedDBTypeForClass.put( Character.class, "char" );
8383
expectedDBTypeForClass.put( char.class, "char" );
8484
expectedDBTypeForClass.put( String.class, "varchar" );
85-
expectedDBTypeForClass.put( String[].class, "varbinary" );
86-
expectedDBTypeForClass.put( Long[].class, "varbinary" );
87-
expectedDBTypeForClass.put( BigDecimal[].class, "varbinary" );
88-
expectedDBTypeForClass.put( BigInteger[].class, "varbinary" );
89-
expectedDBTypeForClass.put( Boolean[].class, "varbinary" );
85+
expectedDBTypeForClass.put( String[].class, "xml" );
86+
expectedDBTypeForClass.put( Long[].class, "xml" );
87+
expectedDBTypeForClass.put( BigDecimal[].class, "xml" );
88+
expectedDBTypeForClass.put( BigInteger[].class, "xml" );
89+
expectedDBTypeForClass.put( Boolean[].class, "xml" );
9090
}}
9191

9292
/**

hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateTestBase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
2525
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
2626
import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
27+
import static org.hibernate.reactive.util.impl.CompletionStages.voidFuture;
2728
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
2829
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
2930

@@ -63,6 +64,11 @@ protected Configuration constructConfiguration(String action) {
6364
return configuration;
6465
}
6566

67+
@Override
68+
public CompletionStage<Void> deleteEntities(Class<?>... entities) {
69+
return voidFuture();
70+
}
71+
6672
@BeforeEach
6773
@Override
6874
public void before(VertxTestContext context) {

hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JavaTypesArrayTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.List;
1717
import java.util.Set;
1818
import java.util.UUID;
19+
import java.util.concurrent.CompletionStage;
1920
import java.util.function.Consumer;
2021
import java.util.function.Predicate;
2122

@@ -49,6 +50,7 @@
4950
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
5051
import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
5152
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
53+
import static org.hibernate.reactive.util.impl.CompletionStages.voidFuture;
5254
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
5355
import static org.junit.jupiter.api.Assertions.assertEquals;
5456
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -73,6 +75,13 @@ protected Configuration constructConfiguration() {
7375
return configuration;
7476
}
7577

78+
@Override
79+
public CompletionStage<Void> deleteEntities(Class<?>... entities) {
80+
// Deleting the entities after each test is not really necessary, and sometimes it causes errors in the log
81+
// that make it harder to figure out what's going on
82+
return voidFuture();
83+
}
84+
7685
@Override
7786
protected void addServices(StandardServiceRegistryBuilder builder) {
7887
sqlTracker.registerService( builder );
@@ -91,7 +100,7 @@ private void testField(VertxTestContext context, Basic original, Consumer<Basic>
91100
if ( List.of( DB2, SQLSERVER ).contains( dbType() ) ) {
92101
test( context, assertThrown( HibernateException.class, getSessionFactory()
93102
.withTransaction( s -> s.persist( original ) ) )
94-
.thenAccept( e -> assertThat( e.getMessage() ).startsWith( "HR000081" ) )
103+
.thenAccept( e -> assertThat( e.getMessage() ).startsWith( "HR000081: " ) )
95104
);
96105
}
97106
else {

0 commit comments

Comments
 (0)