How to use table partitioning with Hibernate (parts 1 month)

Hello, we encountered the need for database partition tables.

We need to divide the table into parts 1 month (datetime timestamp).
Partitioning Using Inheritance.

CREATE TABLE test (
id int8 NOT NULL,
versionobject int8 NOT NULL DEFAULT 1,
person_id int8 NULL,
datetime timestamp NOT NULL,
CONSTRAINT test_pkey PRIMARY KEY (id)
);
CREATE TABLE test_2022_01_01 (
CHECK (datetime >= DATE ‘2022-01-01’ AND datetime < DATE ‘2022-02-01’)
) INHERITS (test);

There is a trigger that writes data to the desired part.

Cannot add row

NHibernate.StaleStateException: “Unexpected row count: 0; expected: 1”
Modules.ORMNHibernate.TestRepository.Add.AnonymousMethod__0() in TestRepository.cs
Modules.ORMNHibernate.TestRepository.ExecuteAndRollbackIfException(System.Func) in TestRepository.cs
Modules.ORMNHibernate.TestRepository.Add(System.Collections.Generic.IEnumerable, string, bool) in TestRepository.cs

Thanks

This is a forum for Hibernate, the Java ORM, not NHibernate. Please choose one of the appropriate groups for NHibernate from Groups - NHibernate

Relatedly, if NHibernate has the same concepts, you would have to use @SQLInsert(sql = "insert into test(id, versionobject, person_id, datetime) values (?, ?, ?, ?)", check = ResultCheckStyle.NONE) to tell Hibernate that the JDBC statement update count should be ignored since the trigger doesn’t return the proper update count via JDBC.

Thanks! This should help me.