spring jdbctemplate和Hibernate之间的区别
我的问题很简单:Spring jdbcTemplate和Hibernate的主要区别是什么?我们应该考虑使用其中一个或另一个的主要原因是什么?
My question just simple : what are the main differences between Spring jdbcTemplate and Hibernate ? what are the main reasons we should take into account for using one or the other ?
谢谢
Thanks
Hibernate是一个真正巨大的数据持久化和ORM解决方案,包括JPA实现。此外,还定义了许多方法来管理Hibernate中的实体,如何持久化,事务等。在Hibernate中,您可以使用SQL,HQL或Java注释。 JDBC模板只是一个简单的工具,可以帮助您管理SQL查询和事务。它可能更好地描述为JDBC包装器或帮助器。如果您更喜欢自己管理数据库查询(SQL),或者如果您是初学者,那么使用Spring JdbcTemplate将帮助您了解它的工作原理。即使你正在研究更大的应用程序,也应该考虑使用Hibernate。只要小心Hibernate的学习曲线。
Hibernate is a really huge solution with data persistence and ORM including JPA implementation. Also, there are defined many ways how to manage entities in Hibernate, how to persist, transactions, etc. In hibernate you can use SQL, HQL or java annotations. JDBC template is just a simple tool that helps you to manage SQL queries and transactions. It is probably better described as a JDBC wrapper or helper. If you prefer managing database queries (SQL) yourself or if you are a beginner, using Spring JdbcTemplate will help you understand how it works. Even if you are working on a bigger application, think about using Hibernate. Just be wary of the learning curve of Hibernate.