Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate over Jdbc

 
Manikandan Swaminathan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

I guess this question might be asked before,but just want to know is there any compelling reason to prefer hibernate over jdbc other
than the following:

1. Database independent,the code works for Oracle,MySQL,SQlServer etc
2. No knowledge of SQL is needed.
3. No need for query tuning as hibernate has criteria queries
4. Support for cache

Other than the above, is there any other advantage to use hibernate over jdbc?


 
Spencer Fingleton
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other things that I can think of:
- You don't need to write tons of JDBC based boiler plate code.
- It's easy to model inheritance hierarchies in Hibernate. Therefore, you can have code with a more OO flavour to it. I have no experience in trying this in JDBC. But we used to have a persistence strategy that was based on JDBC and it basically had a flat structure (next to no use of inheritance). This then promotes procedural code....
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

3. No need for query tuning as hibernate has criteria queries

This is not true. Hibernate doesn't generate well tuned SQL. That can only be done manually, since so much of what makes SQL performant or otherwise is based on the data and its use as well as the model. Database applications need performance tuning, regardless of the data access technology used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic