• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Advantage of ORM over JDBC  RSS feed

Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body clearly explain me what is the advantage of ORM over JDBC. I have an idea on ,how ORM works but I am not aware how JDBC works. Please explain the difference between these two .....

Thanks in advance,
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDBC tutorial: http://java.sun.com/docs/books/tutorial/jdbc/index.html
Posts: 2968
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SQL was designed to query data stored in relational database management systems � as a tool it operates in the Relational paradigm.
Java is an Object-Oriented Programming Language � as a tool it operates in the Object-Oriented paradigm.

The task of reconstituting objects from pure data retrieved from an RDBMS and later distilling objects to pure data to be stored in the RDBMS can be a complex and onerous task, which is why the term Object-Relational Impedance Mismatch is usually associated with that task. In many cases the database does much more for the business then just serve as a persistent store for OO applications � so the DB Data-model and the OO Domain Model (which can vary from application to application) may not even align properly.

JDBC simply allows you to query and modify data in the database with SQL DML (including the escape syntax to use stored procedures) but is does not reconstitute or save Domain Objects.

Mapping Objects to Relational Databases: O/R Mapping In Detail

Object Relational Mapping (ORM) tools attempt to address the Object-Relational Impedance Mismatch by providing a general framework that through configuration knows how to map your Domain Objects to/from the Database so that you can concentrate on the Domain Model and it's business rules.

Just some articles that deal with the problems and solutions to the Object-Relational Impedance Mismatch before Object-Relational Mapping became more common:

Object-Oriented Concepts for Database Design
Patterns for Object / Relational Mapping and Access Layers
Relational Database Access Layers A Pattern Language: The Key Patterns
Relational Database Access Layers A Pattern Language
Object Identifiers for Relational Legacy Data
Crossing Chasms: The Architectural Patterns
Crossing Chasms: A Pattern Language for Object-RDBMS Integration "The Static Patterns"
[ April 12, 2006: Message edited by: Peer Reynders ]
Posts: 17344
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice post Peer.

What you also find out is that when you have JDBC code directly in your code, you write much more code, which costs money to maintain. Then you end up refactoring and refactoring to make it nicer and easier, and after a while you find that you start creating the same kind of design that an ORM tool already gives you, or you hope so.

With an ORM tool, you can concentrate more on business logic and not on lower levels like direct JDBC calls.

Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This explains the difference between JDBC DAOs and ORM:


Also, you should find this posting interesting:


When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!