Well your first question is really should I use straight JDBC or should I use an ORM?
ORM's offer a lot of benefits but there is also pitfalls for the inexperienced. If your talking about a production application I think it comes down to what your teams abilities are and if they have the comfort level and experience to support and write proper code using an ORM. If they are I would go with the ORM otherwise probably JDBC.
If you are talking about a personal project with the goal of learning, I would start with Spring JDBC (JDBC Template) if you are not very familiar with it yet. If you are comfortable with straight JDBC then I would go ahead and start delving into the world of ORM and learn that next, but definitely in that order.
Hibernate is just one persistence provider which is a fine choice. On top of that there is JPA which is a specification. I would choose this over hibernate specific code. Spring data is another project which abstracts things even more and is definitely worthwhile if you choose the ORM route.
Thank You. I understood the advantage of ORMs to normal JDBC and have already used JDBC template and hibrenate in appications.However my doubt is that for an application
when to go for Hibernate over JPA,Sping JDBC template ?
when to go for Sping JDBC template over JPA,Hibernate?
when to go for JPA over JPA,Sping JDBC template?
I would always choose JPA over vanilla hibernate. The only time I wouldn't is if it is a pre-existing application where it would be major rework to make it JPA. If there is a specification best to try to use it, that way if you want to switch out persistence providers later it is an easy task.
I would always choose JPA over JDBC
1.If I have a team that has a good grasp of JPA or I am the only developer.
2. The data model easily supports it (There have been a couple times where the data model on some legacy DB is such a mess that I have chosen JDBC not because it could not be done with JPA, but it would have been a bigger headache then it is worth.)
3. The environment has enough resources to support the ORM (a few projects I have been on required a really lean dependency tree)
If you are using JDBC and Spring I would always use JDBC Template.
If you are using JPA and Spring I would always use Spring-data JPA.
Just to concur. Bill's last post is exactly what my recommendations would be.
Personally I would always use Spring Data JPA for relational databases, because I am an expert and know how to write it such that the data access is faster than straight JDBC. But you have to have an expert on your team. If not, you will cripple your application by doing things wrong.
I also use NoSQL, so I use Spring Data modules for the NoSQL databases that I also use.