Skip to content

Commit a182a10

Browse files
committed
Revert "HHH-7287 - Problem in caching proper natural-id-values when obtaining result by naturalIdQuery"
This reverts commit f0c6c9c.
1 parent 6a7ba40 commit a182a10

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/MutableNaturalIdTest.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import static org.junit.jupiter.api.Assertions.assertNotNull;
3030
import static org.junit.jupiter.api.Assertions.assertNotSame;
3131
import static org.junit.jupiter.api.Assertions.assertNull;
32-
import static org.junit.jupiter.api.Assertions.assertSame;
3332

3433
/**
3534
* @author Gavin King
@@ -59,7 +58,7 @@ public void testNaturalIdNullability(SessionFactoryScope scope) {
5958

6059
@AfterEach
6160
public void dropTestData(SessionFactoryScope scope) {
62-
scope.dropData();
61+
scope.getSessionFactory().getSchemaManager().truncate();
6362
}
6463

6564
@Test
@@ -363,41 +362,4 @@ public void testEviction(SessionFactoryScope scope) {
363362
}
364363
);
365364
}
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-
}
403365
}

0 commit comments

Comments
 (0)