Hi,
Here is a scenario while integrating the Hibernate and its performance
1. I have 8 tables one Master table and 7 child tables. I generated a hbm file that contains link to all the tables as per the database.
2. hbm file is created using the tool in the eclipse
3. POJO objects are created basing on the database design. Master POJO and in that we have objects of all the other 7 tables
4. I do have 8 select queries that execute on above 8 table. In which
Query 1 – Will retrieve information from table 1 & table 2
Query 2 – Will retrieve information from table 1, table 2 and table 3
Query 3 – Will retrieve information from table 1, table 3 and table 4
Query 4 – Will retrieve information from table 1, table 4 and table 5
Query 5 – Will retrieve information from table 1, table 2, table 3 and table 4
Query 6 – Will retrieve information from table 1, table 2, table 3, table 4, table 5, table 6, table 7, table 8
Query 7 – Will retrieve information from table 1, table 2, table 6, table 7, table 8
Query 8 – Will retrieve information from table 1, table 7, table 8
Now the question is because by Master POJO contains links to all the object does hibernate loads all the objects in the memory irrespective of the query.
For example Query 1 is executed – In this I am trying to retrieve the values for two tables, but my Master POJO and its hbm file contains link to all the tables. So does that mean it will load the content for the rest of the tables even though I am not querying it in the same query.
If so what would be the best approach for all the above queries that to be followed in the hibernate.
Thanks
Badri


Reply With Quote
