Hibernate and Oracle Partitions

I am working with a large Oracle database containing partitioned tables. To optimize my queries, I would normally include the partition key in the query so Oracle prunes off partitions. Is Hibernate partition-aware? If I add the partition key clause to my query, will it run faster because Hibernate eliminates the proper partitions from the query? Also, does it make a difference if I use native SQL? If I use native SQL, can I assume the query is run directly in Oracle and the partitions are pruned?

1 Like

Hibernate does not have native support for database partioning. However, as long as you provide the partition key in your queries (either JPQL or native SQL), the database should take it into consideration and prune partitions that are not eligible.

2 Likes