views:

257

answers:

1

Hi.

What is essential difference between these methods?

query() of JdbcTemplate and createQuery() of EntityManager?

As I understand, both execute query?

+1  A: 

JdbcTemplate.query() executes a raw SQL query via Spring's JDBC API

EntityManager.createQuery() creates, but does not execute, a JPA query, via the native JPA API.

Same end result, very different mechanism.

skaffman
thank you, i asked this question because it was strange for me ,when in Spring project was used EntityManager expression.
sergionni