The question, what is faster is impossible to answer without specifying an exact use case.
JdbcTemplate
will most likely be faster when talking about pure query execution, because a JPA implementation will do more stuff:
- Parse JPQL (assuming you are using that)
- creating a SQL query out of that
- executing it
- converting the result into objects
While the template will (almost) just:
- execute the query
- hand you the result as a call to
ResultSetMapper
or similar.
Of course JPA does all of this for a reason.
- it offers a reasonable amount of database independence.
- it tracks your changes and generates the right update statements for persisting them.
- it allows for lazy loading so you don't have to think about what to load before hand (of course you still have to do that if you care about performance).
And those things have costs beyond performance.
The abstraction JPA offers is actually really complex and leaky and it is not properly understood by most developers using it. While I think it is completely reasonable to use JPA in many contexts, I can also relate to people banning it from their projects. Talking about performance is absolutely too limited in order to make a well-educated decision on this.