Hibernate vs Spring JdbcTemplate
- If you can’t understand how Hibernate works, your project will be riddled with strange bugs that will take ages to find and fix.
- It heavily depends on your model, DAO , collections outside transactions
JdbcTemplateis easier because it’s just a very thin wrapper around JDBC itself. The expense here is that you will write hundreds of lines of code. Also, you will find that SQL strings are really hard to maintain.
- Depending on what you need, you can use either of them or both
Hibernate in same project.
- What you need to do is share
- Most folks use hibernate for normal operations, if there are big queries or heavy operations, we check performance for jdbc and hibernate whichever better we use it.
- HibernateTransactionManager works for both (JdbcTemplate, plain jdbc) and hibernate.
Refer this SO thread to dive into more details: