Skip to content

Commit d9814ae

Browse files
committed
HHH-19608 it seems that SQL Server also requires that partition keys belong to PK
1 parent 5cf714f commit d9814ae

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4614,7 +4614,10 @@ public void augmentRecognizedTableTypes(List<String> tableTypesList) {
46144614
}
46154615

46164616
/**
4617-
* Does is dialect support {@code partition by}?
4617+
* Does is dialect support {@code partition by} in window
4618+
* functions?
4619+
*
4620+
* @apiNote This has nothing to do with table partitioning.
46184621
*
46194622
* @since 5.2
46204623
*/
@@ -4624,7 +4627,10 @@ public boolean supportsPartitionBy() {
46244627

46254628
/**
46264629
* Does this dialect require that the columns listed in
4627-
* {@code partition by} also occur in the primary key?
4630+
* {@code partition by} also occur in the primary key,
4631+
* when defining table partitioning?
4632+
*
4633+
* @apiNote This has nothing to do with window functions.
46284634
*
46294635
* @since 7.1
46304636
*/

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ public String getCurrentTimestampSelectString() {
676676

677677
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
678678

679+
@Override
680+
public boolean addPartitionKeyToPrimaryKey() {
681+
return true;
682+
}
683+
679684
@Override
680685
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
681686
return false;

0 commit comments

Comments
 (0)