This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate Native SQL versus iBATIS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Native SQL versus iBATIS" Watch "Hibernate Native SQL versus iBATIS" New topic

Hibernate Native SQL versus iBATIS

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
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?
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Hibernate Native SQL versus iBATIS
jQuery in Action, 3rd edition