Originally posted by Ankur Saxena:
Hi all,
I am new in the Hibernate world, till now I am working on business logic with JDBC and Java Stored Procedures. I wanna know if I need 10 values from 10 different tables to use these values in my business logic then di I have to create 10 objects of beans 10 table mappings in Hibernate ,but through JDBC I can create a view and do the same then tell me how Hibernate reducing the complexity in this case.
If those 10 values should appear in 10 tables,
you should be able to JOIN them together. If you can write enough SQL to present them as a single view, you should be able to manage it in Hibernate, too.
The larger question is: where is it appropriate to do the JOIN?
One benefit of creating that view is information hiding. Clients of your database can treat the view as an interface. You can normalize/denormalize the tables behind it to your heart's content, as long as you don't change the contract with clients.
Complexity is what it is. I don't think Hibernate will eliminate it if it's already present in your data model. Hibernate just provides a way to map from objects to the relational model and back. The idea is that the object and relational models should be independent. What's best for one isn't always optimal for the other. Hibernate allows them to vary independently.
%