This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have used Hiberbernate in production in the past. I have used HQL of Hibernate, never used Native SQL though.
However for the new project, I have a complex database over which I do not have much control.
If I were to choose Hibernate (version 3.2) for this new project, I will have a frequent need to use Native SQL.
So, this is my question: 1. If I were to use Hibernate 3.2 with Native SQL in several places of the project, am I better off using iBATIS?
If it is not possible to answer my above question (question 1), without additional details, will it be possible to provide me some pointers and links on the following questions: 2. What are the drawbacks of using Native SQL in Hibernate? 3. What was the motivation of introducing Native SQL with the newer version of Hibernate? 4. What are the advantages of using Nattive SQL?
First I would just point out that even if you have no control over how the database is modeled, doesn't stop you from mapping Java Objects to those database tables. Hibernate can pretty much map to any database model.
As far as using straight SQL, I would choose iBatis over JDBC, and if everything you write will be native SQL queries then I can also recommend iBatis. But if it was me personally, I still would choose Hibernate.