Suppose I have a table \'student\' in DB which is very LARGE. There are several columns in student, including \'id\' and \'class-id\'.
In hbm file I currently have t
No, unfortunately there is not anything like that in Hibernate.
Actually, it is very difficult to use database partitioning together with Hibernate because of the way Hibernate reads associated entities. Let's say that we have entity A with a many-to-one mapping to entity B. When Hibernate reads entity A, it will automatically read entity B. It depends on fetch plan and strategy how and when B is exactly loaded from database, but in any case it is a query that will not contain partition column in the where clause (if composite primary keys are not used).
I hope that future versions of Hibernate will take this into consideration.
However, you can take a look at Hibernate filters, maybe they can be useful for your partitioning needs. Keep in mind though that filters are not applied when reading entities by id, meaning again that reading entities in many-to-one associations will not include partition condition. This could be overcome by using global indexes if your database supports them (but they have their own pitfalls).
Also, depending on what you use partitioning for, you could create database views which include partition condition and then map Hibernate entities to the views.
Or, as you mentioned, and I would also say that this is the most straightforward way given other circumstances, you could go with composite primary keys and use your own implementation of id generator (actually, it should not be difficult to implement one, if this is your only reason not to consider composite ids).