Skip to content

Commit 1afe335

Browse files
committed
Make FormulaWithPartitionByTest deterministic and enable partition by tests on H2
1 parent ac3e9ca commit 1afe335

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/H2LegacyDialect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,11 @@ public String getCaseInsensitiveLike() {
10461046
}
10471047
}
10481048

1049+
@Override
1050+
public boolean supportsPartitionBy() {
1051+
return getVersion().isSameOrAfter( 1, 4, 200 );
1052+
}
1053+
10491054
@Override
10501055
public boolean supportsCaseInsensitiveLike() {
10511056
return getVersion().isSameOrAfter( 1, 4, 194 );

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,11 @@ public boolean supportsCaseInsensitiveLike(){
10551055
return true;
10561056
}
10571057

1058+
@Override
1059+
public boolean supportsPartitionBy() {
1060+
return true;
1061+
}
1062+
10581063
@Override
10591064
public boolean supportsBindingNullSqlTypeForSetNull() {
10601065
return true;

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/formula/FormulaWithPartitionByTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static class DisplayItem implements Serializable {
9090
@Column(name = "DISCOUNT_VALUE")
9191
private Double discountValue;
9292

93-
@Formula("ROW_NUMBER() OVER( PARTITION BY DISCOUNT_CODE ORDER BY SIGN(DISCOUNT_VALUE) DESC )")
93+
@Formula("ROW_NUMBER() OVER(PARTITION BY DISCOUNT_CODE ORDER BY ID)")
9494
private Integer itemsByCode;
9595

9696
public Integer getId() {

0 commit comments

Comments
 (0)