Skip to content

Commit e2b93cb

Browse files
committed
HHH-7287 - Problem in caching proper natural-id-values when obtaining result by naturalIdQuery
1 parent cbcdd23 commit e2b93cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,10 @@ public void testEviction(SessionFactoryScope scope) {
367367
@Test
368368
@JiraKey("HHH-7287")
369369
public void testModificationInOtherSession(SessionFactoryScope factoryScope) {
370-
factoryScope.inTransaction( (session) -> {
370+
var id = factoryScope.fromTransaction( (session) -> {
371371
User u = new User( "gavin", "hb", "secret" );
372372
session.persist( u );
373+
return u.getId();
373374
} );
374375

375376
// Use transactionless session
@@ -380,7 +381,7 @@ public void testModificationInOtherSession(SessionFactoryScope factoryScope) {
380381

381382
// CHANGE natural-id values in another session
382383
factoryScope.inTransaction( (otherSession) -> {
383-
var u = otherSession.find( User.class, 1 );
384+
var u = otherSession.find( User.class, id );
384385
u.setOrg( "zz" );
385386
} );
386387
// CHANGE APPLIED

0 commit comments

Comments
 (0)