Skip to content

Commit 645d8f7

Browse files
committed
[#2398] Add test to show Mutation query with Joined Inheritance for databases supporting Global Temporary Tabels issue has been solved
1 parent 67fe139 commit 645d8f7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
package org.hibernate.reactive;
77

8+
import org.hibernate.reactive.annotations.DisabledFor;
9+
810
import org.junit.jupiter.api.Assertions;
911
import org.junit.jupiter.api.Test;
1012

@@ -28,6 +30,7 @@
2830

2931
import static java.util.concurrent.TimeUnit.MINUTES;
3032
import static org.assertj.core.api.Assertions.assertThat;
33+
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
3134

3235
@Timeout(value = 10, timeUnit = MINUTES)
3336

@@ -185,6 +188,31 @@ public void testQueryUpdateWithParameters(VertxTestContext context) {
185188
);
186189
}
187190

191+
@Test
192+
@DisabledFor( value = POSTGRESQL, reason = "vertx-sql-client issue: https://github.com/eclipse-vertx/vertx-sql-client/issues/1540" )
193+
public void testHqlInsertWithTransaction(VertxTestContext context) {
194+
Integer id = 1;
195+
String title = "Spell Book: A Comprehensive Guide to Magic Spells and Incantations";
196+
test( context, getMutinySessionFactory()
197+
.withTransaction( session -> session.createMutationQuery( "insert into SpellBook (id, title, forbidden) values (:id, :title, :forbidden)" )
198+
.setParameter( "id", id )
199+
.setParameter( "title", title )
200+
.setParameter( "forbidden", true )
201+
.executeUpdate()
202+
).call( () -> getMutinySessionFactory()
203+
.withTransaction( session -> session.createSelectionQuery( "from SpellBook g where g.id = :id ", SpellBook.class )
204+
.setParameter( "id", id )
205+
.getSingleResult()
206+
.invoke( spellBook -> {
207+
assertThat( spellBook.getTitle() ).isEqualTo( title );
208+
assertThat( spellBook.forbidden ).isTrue();
209+
}
210+
)
211+
)
212+
)
213+
);
214+
}
215+
188216
@Entity(name="SpellBook")
189217
@Table(name = "SpellBookJS")
190218
@DiscriminatorValue("S")

0 commit comments

Comments
 (0)