File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Advantage of ORM over JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Advantage of ORM over JDBC" Watch "Advantage of ORM over JDBC" New topic
Author

Advantage of ORM over JDBC

Srinivas Redd
Greenhorn

Joined: Mar 23, 2006
Posts: 17
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,
Srinivas.


Srinvasa Reddy Thamma,<br />Chennai,India.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
JDBC tutorial: http://java.sun.com/docs/books/tutorial/jdbc/index.html


There is no emoticon for what I am feeling!
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
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 ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Pj Murray
Ranch Hand

Joined: Sep 24, 2004
Posts: 194
This explains the difference between JDBC DAOs and ORM:

http://www.codefutures.com/weblog/andygrove/archives/2005/02/data_access_obj.html


Also, you should find this posting interesting:

http://www.codefutures.com/weblog/andygrove/archives/2005/01/choosing_a_java.html


Regards
PJ


PJ Murray -
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advantage of ORM over JDBC
 
Similar Threads
JDBC OR HIBERNATE ?
advantage of JDBC drivers over JDBC-ODBC bridge
Wht is data persistency.
what are the advantage of Hibernate Over Jdbc?
Somewhat frustrated