Let’s consider this table:
CREATE TABLE `my_table` (
`id` varchar(255) NOT NULL,
`year` int DEFAULT 2000
)
I would love to get my_table
(and two other tables) partitioned based on the value of year
(year
is Superior to 2000) and get all CRUD statements possible from my Application using hibernate.
for the moment all I have are manually defined tables my_table_2000
,my_table_2001
,…
and for each I have an Entity:
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Data
public class MyTable_2000 {
@Id
String id;
Integer year;
}
a repository for each one, and, in each year, I need to create new partitions and update the code which is complicated.
since MySql supports only list and range partitioning, I am asking if hibernate can help with partitioning management specially to auto create partitions each time we try to save an entity with a new value of year
I work in spring boot ecosystem
1