Skip to content

Commit 342b7ba

Browse files
committed
HHH-19608 tests for partitioning on Informix and Maria
1 parent ece23a8 commit 342b7ba

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.orm.test.sql.partition;
6+
7+
import jakarta.persistence.Entity;
8+
import jakarta.persistence.Id;
9+
import jakarta.persistence.Table;
10+
import org.hibernate.annotations.PartitionKey;
11+
import org.hibernate.community.dialect.InformixDialect;
12+
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
13+
import org.hibernate.testing.orm.junit.Jpa;
14+
import org.hibernate.testing.orm.junit.RequiresDialect;
15+
import org.junit.jupiter.api.Test;
16+
17+
import static org.junit.jupiter.api.Assertions.assertNotNull;
18+
19+
@RequiresDialect(InformixDialect.class)
20+
@Jpa(annotatedClasses = InformixPartitionedTableTest.Partitioned.class)
21+
class InformixPartitionedTableTest {
22+
@Test void test(EntityManagerFactoryScope scope) {
23+
scope.inTransaction( session -> {
24+
Partitioned partitioned = new Partitioned();
25+
partitioned.id = 1L;
26+
partitioned.pid = 500L;
27+
session.persist( partitioned );
28+
} );
29+
scope.inTransaction( session -> {
30+
Partitioned partitioned = session.find( Partitioned.class, 1L );
31+
assertNotNull( partitioned );
32+
partitioned.text = "updated";
33+
} );
34+
}
35+
@Entity
36+
@Table(name = "infoparts",
37+
options =
38+
"""
39+
FRAGMENT BY RANGE (pid)
40+
INTERVAL (1000) STORE IN (rootdbs)
41+
PARTITION p1 VALUES < 1000 IN rootdbs,
42+
PARTITION p2 VALUES < 2000 IN rootdbs
43+
""")
44+
static class Partitioned {
45+
@Id Long id;
46+
@PartitionKey Long pid;
47+
String text = "";
48+
}
49+
}

hibernate-core/src/test/java/org/hibernate/orm/test/sql/partition/MySQLPartitionedTableTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import jakarta.persistence.Id;
99
import jakarta.persistence.Table;
1010
import org.hibernate.annotations.PartitionKey;
11+
import org.hibernate.dialect.MariaDBDialect;
1112
import org.hibernate.dialect.MySQLDialect;
1213
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
1314
import org.hibernate.testing.orm.junit.Jpa;
@@ -17,6 +18,7 @@
1718
import static org.junit.jupiter.api.Assertions.assertNotNull;
1819

1920
@RequiresDialect(MySQLDialect.class)
21+
@RequiresDialect(MariaDBDialect.class)
2022
@Jpa(annotatedClasses = MySQLPartitionedTableTest.Partitioned.class)
2123
class MySQLPartitionedTableTest {
2224
@Test void test(EntityManagerFactoryScope scope) {

0 commit comments

Comments
 (0)