Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ORM and JDBC

 
vijayaraghava mutharaju
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a blog posting here with a comparison of these Java persistence technology choices here:

http://www.codefutures.com/weblog/corporate/archives/2005/02/data_persistenc.html

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


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

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:

http://www.codefutures.com/weblog/andygrove/archives/2005/02/data_access_obj.html
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.

Mark
 
Magesh Lakshmi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic