It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes ORM and 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 "ORM and JDBC" Watch "ORM and JDBC" New topic


vijayaraghava mutharaju

Joined: Nov 04, 2005
Posts: 14

This could be a newbie question on ORM but bear with it.I want to know the additional benefits that of using ORM(tools) over JDBC.Some of things I found out are
1)we can use normal save,load and Hibernate(eg.) converts them automatically using SQL queries.
2)It provides support to store associations between classes.
3)Makes overall handling of the databases easier & improves performance.

Thank you.
Pj Murray
Ranch Hand

Joined: Sep 24, 2004
Posts: 194
There's a blog posting here with a comparison of these Java persistence technology choices here:

Also, in relation to your question on ORM, you should might like to read a blog entry on "Choosing a data persistence strategy":

I should point out that there's generally too much attention paid to the choice of Java persistence technology (e.g. Hibernate versus JDO) and not enough on the overall architectural strategy.

While using an ORM technology has benefits, you should also always consider using Data Access Objects - which will provide you with a level of independence from the technology choice (i.e. you can swap between ORM or JDBC or whatever as appropriate). This might be useful:

PJ Murray -
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

"Makes overall handling of the databases easier & improves performance."

I wouldn't necessarily say that it improves performance, and some out there can argue that it doesn't make handling databases easier.

What I think the main thing is that it removes Database specific information from your code, like SQL text. But in some cases you still want to use SQL through an ORM so that it is faster there, and the query is a simple query for like say a lookup.

I personally like the ability to use OO and Objects when dealing with things that represents tables in a database. I don't like dealing with JDBC directly, and ResultSets and Statements, etc. But others are fine with it.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Magesh Lakshmi

Joined: Nov 02, 2005
Posts: 10
JDBC Vs ORM [ in particular Hibernate ]

1. Query by example [ Criterial queries ]
2. Substituting the whole object as parameter to the query
3. Ease of persisting dependency
4. Automapping of result set to objects
5. Pagination
6. Polymorphic queries
7. Implicit joins .. Eg bid.item.category
8. Detached persistence

Note :- JDBC is good at read-only data. So if you are planning to you projections in Hibernate, you should give a shot to JDBC first, definitely faster than projections.

and so many.

I agree. Here's the link:
subject: ORM and JDBC
It's not a secret anymore!