|
29 | 29 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
30 | 30 | import static org.junit.jupiter.api.Assertions.assertNotSame; |
31 | 31 | import static org.junit.jupiter.api.Assertions.assertNull; |
32 | | -import static org.junit.jupiter.api.Assertions.assertSame; |
33 | 32 |
|
34 | 33 | /** |
35 | 34 | * @author Gavin King |
@@ -59,7 +58,7 @@ public void testNaturalIdNullability(SessionFactoryScope scope) { |
59 | 58 |
|
60 | 59 | @AfterEach |
61 | 60 | public void dropTestData(SessionFactoryScope scope) { |
62 | | - scope.dropData(); |
| 61 | + scope.getSessionFactory().getSchemaManager().truncate(); |
63 | 62 | } |
64 | 63 |
|
65 | 64 | @Test |
@@ -363,41 +362,4 @@ public void testEviction(SessionFactoryScope scope) { |
363 | 362 | } |
364 | 363 | ); |
365 | 364 | } |
366 | | - |
367 | | - @Test |
368 | | - @JiraKey("HHH-7287") |
369 | | - public void testModificationInOtherSession(SessionFactoryScope factoryScope) { |
370 | | - factoryScope.inTransaction( (session) -> { |
371 | | - User u = new User( "gavin", "hb", "secret" ); |
372 | | - session.persist( u ); |
373 | | - } ); |
374 | | - |
375 | | - // Use transactionless session |
376 | | - factoryScope.inSession( (session) -> { |
377 | | - // this loads the state into this `session` |
378 | | - var byNaturalId = session.byNaturalId( User.class ).using( "name", "gavin" ).using( "org", "hb" ).load(); |
379 | | - assertNotNull( byNaturalId ); |
380 | | - |
381 | | - // CHANGE natural-id values in another session |
382 | | - factoryScope.inTransaction( (otherSession) -> { |
383 | | - var u = otherSession.find( User.class, 1 ); |
384 | | - u.setOrg( "zz" ); |
385 | | - } ); |
386 | | - // CHANGE APPLIED |
387 | | - |
388 | | - byNaturalId = session.byNaturalId( User.class ) |
389 | | - .using( "name", "gavin" ) |
390 | | - .using( "org", "hb" ).load(); |
391 | | - assertNotNull( byNaturalId ); |
392 | | - |
393 | | - // the internal query will 'see' the new values, because isolation level < SERIALIZABLE |
394 | | - var byNaturalId2 = session.byNaturalId( User.class ) |
395 | | - .using( "name", "gavin" ) |
396 | | - .using( "org", "zz" ).load(); |
397 | | - assertSame( byNaturalId, byNaturalId2 ); |
398 | | - |
399 | | - // this fails, that's the bug |
400 | | - assertNotNull( session.byNaturalId( User.class ).using( "name", "gavin" ).using( "org", "hb" ).load()); |
401 | | - } ); |
402 | | - } |
403 | 365 | } |
0 commit comments