Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes Hibernate over Jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate over Jdbc" Watch "Hibernate over Jdbc" New topic
Author

Hibernate over Jdbc

Manikandan Swaminathan
Ranch Hand

Joined: Aug 10, 2008
Posts: 117
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

Joined: Mar 30, 2010
Posts: 9
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

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate over Jdbc