Spring Hibernate Vs jdbc template vs spring orm [closed]
Asked Answered
S

1

9

We have a project with MySQL database and Spring as the framework. I am very new to Spring and looking to implement the database access layer and found that there are several options available, like

  • Using Spring + Hibernate
  • Using Spring JDBC Template
  • Using Spring ORM Module

I have gone through the various posts in stackoverflow and did a bit of research on the web, but every question had different answers supporting different options. Also, I did see a mention about Spring JDBC template not being recommended now.

The application might have approximately 1000 transactions per hour and have 60% reads and 40% writes, approximately.

Can anyone help me in finding an answer as to which of the 3 options is suitable and why ? Or, if you can point me to some resources, that would be highly appreciated as well.

Saury answered 7/8, 2012 at 16:47 Comment(0)
R
25

Hibernate is just one of the many ORM solutions that Spring supports; others are listed here.

You might choose ORM if all of the following were true:

  1. You had a solid object model to map relational data to.
  2. You liked the SQL generated for you by the ORM layer.
  3. Your schema conformed nicely to the requirements of the ORM solution.
  4. You weren't using a lot of stored procedures.
  5. You didn't think you could optimize SQL better than the ORM could.

If any of those aren't true, maybe an ORM isn't for you.

Spring JDBC template is light and simple. I would bet that it could accomodate your stated requirements. I'd recommend going with that until you found out that your requirements drove you to ORM. If you follow the typical Spring idiom and create an interface-based persistence layer, this will mean injecting one implementation instead of another.

Roveover answered 7/8, 2012 at 16:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.