Hi Thank you for reading my post We have an application created using JDBC, for now application works but for next version we are planning to use a ORM framework as some parts of application is going to be re-writted . now my question is : in currect JDBC layer we have tens of dynamically created SQL statement (select / delete / update /insert) we build those statement based on user input and some other business logic.
my question is : Does hibernate support such thig ? for example some times we select a query by joinin 3 tables when user need less details information and sometimes we should engage 5 tables. can we do such tings with hibernate, or hibernate just allows us to have per table objects.
You can always create an SQL Query object, and create your query string.
However, I think as you learn more about Hibernate, your current solutions will probalby change. When you talk about 3 or 5 tables being joined, the first thing that will be a "shock" to you is in regards to eager and lazy loading. You can only eager load one "many" table in such a join, as if you tried to have eager fetching with all 3-5 tables you would create a cartesian product, since Hibernate uses Left Outer Joins. So for those queries you will have to use SQLQuery and work with Object arrays, or "Select new MyObject(a, b, c)" to not have to work with object arrays, but with dynamically created queries you won't know how to create MyObject and its constructors since your query would be different each time.