|
5 | 5 | */
|
6 | 6 | package org.hibernate.reactive;
|
7 | 7 |
|
| 8 | +import org.hibernate.reactive.annotations.DisabledFor; |
| 9 | + |
8 | 10 | import org.junit.jupiter.api.Assertions;
|
9 | 11 | import org.junit.jupiter.api.Test;
|
10 | 12 |
|
|
28 | 30 |
|
29 | 31 | import static java.util.concurrent.TimeUnit.MINUTES;
|
30 | 32 | import static org.assertj.core.api.Assertions.assertThat;
|
| 33 | +import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL; |
31 | 34 |
|
32 | 35 | @Timeout(value = 10, timeUnit = MINUTES)
|
33 | 36 |
|
@@ -185,6 +188,31 @@ public void testQueryUpdateWithParameters(VertxTestContext context) {
|
185 | 188 | );
|
186 | 189 | }
|
187 | 190 |
|
| 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 | + |
188 | 216 | @Entity(name="SpellBook")
|
189 | 217 | @Table(name = "SpellBookJS")
|
190 | 218 | @DiscriminatorValue("S")
|
|
0 commit comments