Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does Spring Framework provide an ORM?

 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been using Spring for a while now but something keeps puzzling me. Does the Spring Framework have an ORM tool? Somthing on the lines of Hibernate or iBatis.

I am aware that using DI a Bean (DAO) can be 'injected' with a Hibernate implementation for database operations. If it does, what are the differences between Spring and other ORM tools available (esp Hibernate)?

Have been trying to find answers on the Internet but have found nothing worth mentioning yet... If anyone could provide any useful link I would love to read more on this topic.

Cheers,
Raj.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Spring doesn't provide an ORM. Spring does integrate with the ORMS out there. Spring would never re-invent the wheel.

So We can integrate Hibernate with Spring so that we can inject a Hibernate SessionFactory into our Spring Repository beans. Or we can integrate with iBatis and inject an SQLMap or whatever the iBatis class is into our Spring Repositories.

Mark
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton, Mark.

I was always asked during interviews why not use Spring ORM instead of Hibernate/iBatis. I spent so much time and effort searching the details about Spring ORM and I drew a blank. Based on this I had answered that Spring Framework does not provide an ORM. To my horror I was scorned at.

Your answer affirms my answers and I could not thank you enough for clarifying.

Cheers,
Raj.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Kamal wrote:Thanks a ton, Mark.

I was always asked during interviews why not use Spring ORM instead of Hibernate/iBatis. I spent so much time and effort searching the details about Spring ORM and I drew a blank. Based on this I had answered that Spring Framework does not provide an ORM. To my horror I was scorned at.

Your answer affirms my answers and I could not thank you enough for clarifying.

Cheers,
Raj.


Mark was quite right. There is no such thing called Spring ORM but Spring offers beautiful ways of integrating with the existing ORM frameworks.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
beauty of Spring framework is "Integration". It provides seamless intgration to many technologies (Struts, Hibernate etc).
Although Spring do have built some of its own components like Spring MVC.

~ abhay
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the interviewer says that that is wrong. They might think that Spring's JdbcTemplate is an ORM, even though it is not. It is just a class that simplifies running queries through JDBC, with some callback interfaces that you can implement for converting ResultSet data into domain objects, but that is far from mapping in an Object Relational Mapping product.

Mark
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which just goes to show that an interview doesn't always just reveal what the interviewee knows or doesn't know.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic