Ximing Yu wrote:I'm working with a legacy database and have about 30 tables with same columns. There will be 13 million rows in total in the 30 tables. Is it possible to map a class to all 30 tables and have an attribute in class that map to different table name?
Using SQL to do query in any one table is already quite slow, so I doubt combining all 30 tables to one big table will result in unbearable low efficiency. Anyone have any idea about solving this kind of problem? Thanks.
Hibernate can map subclasses to one table or to their own table. I have not done this myself (I always used one table for all subclasses) but I guessing that you can create a parent class and then create a subclass for each of the tables. This would allow you to work with given objects/tables as needed and allow you to work with the parent table so as to query within all of the tables.