How to use table partitioning with Hibernate

Hibernate Shards is a horizontal partitioning scheme

There used to be an incubating project called Hibernate Shards, but it was discontinued due to lack of contributions from the community.

but partitioning is also a term sometimes used to indicate fine-grained control of a single database, and in that context, Hibernate isn’t likely to be able to help, since that sort of feature is generally going to vary with the database vendor.

You can also use multitenancy, which Hibernate supports and can be used for isolating users if that’s your use case.

DBMS-specific partitioning is also not usually something that apps would be doing, since it’s mostly about performance and physical robustness, which are generally best maintained across the enterprise by the DBA, whose job it is to balance resources for the enterprise as a whole.

That does not sound like DevOps at all. The DB is no island, just like the application. They form a system, so partitioning is yet another task that needs to be addressed by the team who’s developing and monitoring the system.

Now, just because you are using Hibernate, it does not mean you cannot benefit from DB-specific features. Otherwise, why do you think there is a createNativeQuery method?

Back to partitioning, most DBs support it anway (e.g.MySQL, PostgreSQL).