Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

not able to appreciate the use of O/R tool like HIbernate

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know that O/R tool is used to fill up the space difference between Object oriented language and Relational database. But,thats trivial,right.

Why you should write a bunch of classes and configuration files to map the database tables, while the same can be achieved by a couple of SQL statements read through a XML files and executed through your JAVA CODE and have fill up your class variables or do whatever required processing.


What is the true worth of any O/R tool ?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


But,thats trivial,right.


No, far from it infact. Have a read about the Object-relational impedance mismatch to get an idea of the problems.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even we use hibernate,still has to write significant amount of code.

Whats wrong with the following way.





OR



[ June 06, 2008: Message edited by: Pratap Chowdary ]
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing.
Hibernate / ORM is not the be-all-end-all solution for implementing the data access layer. Neither is the java.sql API.
[ June 06, 2008: Message edited by: Jelle Klap ]
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Absolutely. There is no perfect solution. However, the linked article gives you a bunch of reasons why you might use an ORM tool.
 
Saloon Keeper
Posts: 25782
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the selling points that SolarMetric used to promote their JDO product was the claim that while there are Java experts and there are SQL experts, relatively few people are both. By using ORM, the need to be a SQL expert is reduced.

Another, more demonstrable reason is that in enterprise apps, use of an ORM framework may actually be more efficient than using straight JDBC. In fact, some benchmarks I've seen have shown twice the throughput of hand-coded JDBC.

This might seem counter-intuitive, since ORM uses JDBC to get the job done. But for years people claimed that assembly language was more efficient than high-level languages. Which was true at the micro level, but frequently false at the macro level. ORM technologies are not as lightweight as roll-your-own JDBC, but they offer efficiencies in caching, in load-balancing and other data strategies that make up for it. It's not so much that ORM is inherently more efficient raw JDBC, but by the time you re-created and re-debugged all the ORM features, you'd be overdue to retire, if not laid off.

And, of course, automated frameworks can efficiently redesign and re-optimize an app globally for every minor change, which would be prohibitive if done manually.
 
author and cow tipper
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well said, Tim.

One small thing is the danger of doing SQL in Java code, and then having the SQL tables or column names change. Then you've got to go into all your queries. With something like Hibernate, it's just a few changes to your mapping files or your annotations, and the changes are done.

Structured data we find in databases and object models we find in Java programs are both very different. ORM tools allow Java programmers to think of their data in an object oriented way, and databases allow db admins and database modellers to think of the data in a structured way. This just makes for a more natural way for individuals to address their own problem domain, and that's a good thing.

-Cameron McKenzie
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic