Skip to content

Commit 7b7a964

Browse files
committed
HHH-19330 - Fix for issue
Signed-off-by: Jan Schatteman <[email protected]>
1 parent d539d49 commit 7b7a964

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,11 @@ public String getReadLockString(String aliases, int timeout) {
13161316
return withTimeout(" for share of " + aliases, timeout );
13171317
}
13181318

1319+
@Override
1320+
public String getForUpdateString() {
1321+
return " for no key update";
1322+
}
1323+
13191324
@Override
13201325
public String getForUpdateNowaitString() {
13211326
return supportsNoWait()

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLSqlAstTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ protected void renderMaterializationHint(CteMaterialization materialization) {
188188

189189
@Override
190190
protected String getForUpdate() {
191-
return " for no key update";
191+
return getDialect().getForUpdateString();
192192
}
193193

194194
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/dialect/unit/locktimeout/PostgreSQLLockTimeoutTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void testLockTimeoutNoAliasNoTimeout() {
2828
dialect.getForUpdateString( new LockOptions( LockMode.PESSIMISTIC_READ ) )
2929
);
3030
assertEquals(
31-
" for update",
31+
" for no key update",
3232
dialect.getForUpdateString( new LockOptions( LockMode.PESSIMISTIC_WRITE ) )
3333
);
3434
}
@@ -41,7 +41,7 @@ public void testLockTimeoutNoAliasNoWait() {
4141
.setTimeOut( LockOptions.NO_WAIT ) )
4242
);
4343
assertEquals(
44-
" for update nowait",
44+
" for no key update nowait",
4545
dialect.getForUpdateString( new LockOptions( LockMode.PESSIMISTIC_WRITE )
4646
.setTimeOut( LockOptions.NO_WAIT ) )
4747
);
@@ -55,7 +55,7 @@ public void testLockTimeoutNoAliasSkipLocked() {
5555
.setTimeOut( LockOptions.SKIP_LOCKED ) )
5656
);
5757
assertEquals(
58-
" for update skip locked",
58+
" for no key update skip locked",
5959
dialect.getForUpdateString( new LockOptions( LockMode.PESSIMISTIC_WRITE )
6060
.setTimeOut( LockOptions.SKIP_LOCKED ) )
6161
);
@@ -75,7 +75,7 @@ public void testLockTimeoutAliasNoTimeout() {
7575
)
7676
);
7777
assertEquals(
78-
" for update of a",
78+
" for no key update of a",
7979
dialect.getForUpdateString(
8080
alias,
8181
new LockOptions( LockMode.PESSIMISTIC_WRITE ).setAliasSpecificLockMode(
@@ -101,7 +101,7 @@ public void testLockTimeoutAliasNoWait() {
101101
)
102102
);
103103
assertEquals(
104-
" for update of a nowait",
104+
" for no key update of a nowait",
105105
dialect.getForUpdateString(
106106
alias,
107107
new LockOptions( LockMode.PESSIMISTIC_WRITE ).setAliasSpecificLockMode(
@@ -128,7 +128,7 @@ public void testLockTimeoutAliasSkipLocked() {
128128
)
129129
);
130130
assertEquals(
131-
" for update of a skip locked",
131+
" for no key update of a skip locked",
132132
dialect.getForUpdateString(
133133
alias,
134134
new LockOptions( LockMode.PESSIMISTIC_WRITE ).setAliasSpecificLockMode(

hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiLoadLockingTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.hibernate.testing.orm.junit.SessionFactory;
3434
import org.hibernate.testing.orm.junit.SessionFactoryScope;
3535
import org.hibernate.testing.orm.junit.Setting;
36-
import org.hibernate.testing.orm.junit.SkipForDialect;
3736
import org.junit.jupiter.api.AfterEach;
3837
import org.junit.jupiter.api.BeforeEach;
3938
import org.junit.jupiter.api.Test;
@@ -243,9 +242,6 @@ void testMultiLoadCompositeIdEntityPessimisticReadLockAlreadyInSession(SessionFa
243242

244243
// (3) simple Id entity w/ pessimistic write lock (one in L1C & some in L2C)
245244
@Test
246-
@SkipForDialect( dialectClass = PostgreSQLDialect.class, matchSubTypes = true,
247-
reason = "Excluding PostgreSQL dialects for now; multiload of natural id entities where one is already "
248-
+ "in the session produces more than 1 select, and they have different update lock strings")
249245
public void testMultiLoadSimpleIdEntityPessimisticWriteLockSomeInL1CAndSomeInL2C(SessionFactoryScope scope) {
250246
final Integer userInL2CId = userIds.get(0);
251247
final Integer userInL1CId = userIds.get(1);

0 commit comments

Comments
 (0)