aspose file tools*
The moose likes Spring and the fly likes is spring DAO module a ORM? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "is spring DAO module a ORM?" Watch "is spring DAO module a ORM?" New topic
Author

is spring DAO module a ORM?

VinodhKumar Srinivasan
Greenhorn

Joined: Feb 23, 2008
Posts: 5
Hey Buddies,
This a question came in to mind , when I look ed spring modules. I thing Spring DAO layer is actually a ORM. Wait I can prove it ... What is an ORM- It provides you a 1. Database connectivity,2. Mapping DB objects to Java Objects and 3. Transaction management. So this Spring DAO is a ORM.

The ORM module in spring has to be renamed as something else may be Plug your own ORM :-) or .....


What you say ?

Thanks,
Vinodh
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
No, Spring offers integration to ORM, but it's no ORM.
http://static.springsource.org/spring/docs/2.5.x/reference/orm.html

And you misunderstand, database connectivity and transaction management are not exclusive features of ORM, otherwise pure JDBC can be considered as an ORM solution.

Spring's JDBC abstraction framework doesn't map relational data and objects in a way ORM solutions do either.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
VinodhKumar Srinivasan
Greenhorn

Joined: Feb 23, 2008
Posts: 5
Kengkaj ,
Thanks for your quick reply. I want to know ORM in simple words. That is what is ORM?

-Vinodh
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

VinodhKumar Srinivasan wrote:Kengkaj ,
Thanks for your quick reply. I want to know ORM in simple words. That is what is ORM?

-Vinodh


Object Relational Mapping, or mapping your Java objects to a relational database.

We have an ORM forum too, near the top of the forums list.

Mark


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

Joined: Jul 05, 2005
Posts: 1936
ORM is no standardize term yet. If we just take it literally (Object-Relational Mapping), using JDBC and create an object from an SQL result set is ORM.

However in widely accepted meaning, an ORM solution maps object to relational data using metadata like XML or Annotations, it also offers a query language that maps to SQL.

Hope this helps.
VinodhKumar Srinivasan
Greenhorn

Joined: Feb 23, 2008
Posts: 5
Kengkaj,

Fine explanation. Here Spring JDBC gives
1.configuration files(connection, DAO injection),
2.It uses reflection to load the Java Objects from DB layer.
3. It doesn't give query language that is we have to write the native SQL query.
is the 3rd point makes Spring JDBC Just a abstract layer of JDBC?

Thanks,
Vinodh


Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

VinodhKumar Srinivasan wrote:Kengkaj,

Fine explanation. Here Spring JDBC gives
1.configuration files(connection, DAO injection),
2.It uses reflection to load the Java Objects from DB layer.
3. It doesn't give query language that is we have to write the native SQL query.
is the 3rd point makes Spring JDBC Just a abstract layer of JDBC?

Thanks,
Vinodh




Spring JDBC is kind of just that, the classes help in writing JDBC code, but there is also Spring integration with all the major ORM products, like Hibernate and Top Link.

Mark
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
VinodhKumar Srinivasan wrote:Kengkaj,

Fine explanation. Here Spring JDBC gives
1.configuration files(connection, DAO injection),
2.It uses reflection to load the Java Objects from DB layer.
3. It doesn't give query language that is we have to write the native SQL query.
is the 3rd point makes Spring JDBC Just a abstract layer of JDBC?

I don't know what you mean by "uses reflection". But Spring's JDBC abstraction framework doesn't use metadata to map objects to relational data, so it is not an ORM solution.
You can read more about Spring Framework's JDBC abstraction framework at http://static.springsource.org/spring/docs/2.5.6/reference/jdbc.html.
VinodhKumar Srinivasan
Greenhorn

Joined: Feb 23, 2008
Posts: 5
I agree the point. It is not full fledged ORM. It doesn't provide much meta data things.

-- Refection - Spring would load java objects for us. For this we don't have any specific mapping (like hbm file in hibernate). Instead the simple rule is you have to have java attributes same as your table fields. When we call the JDBC API, You can pass the SQL and java pojo. Then Spring would load the java object, this is done through reflection.



- So the Spring JDBC is like ORM but doesn't support all feature.

- Thanks to all who replied to this post.


Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
VinodhKumar Srinivasan wrote:
- So the Spring JDBC is like ORM but doesn't support all feature.

It's only your opinion which is affected from your point of view about ORM. I don't think Spring JDBC is like ORM at all, developers still do most of the mappings.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Kengkaj Sathianpantarit wrote:
VinodhKumar Srinivasan wrote:
- So the Spring JDBC is like ORM but doesn't support all feature.

It's only your opinion which is affected from your point of view about ORM. I don't think Spring JDBC is like ORM at all, developers still do most of the mappings.


I agree, Spring JDBC is not an ORM.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is spring DAO module a ORM?