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.
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.
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.
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.
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.
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.