Hibernate and Oracle Partitions


#1

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?


#2

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.