JdbcTemplate vs JPA native query?

Viewed 768

I really cannot understand what are the advantages of using the Jdbc template over the native queries. For example the following query:

@Query(native=true, value="select ID from table")
public Integer native1();

is equivalent to:

int result = jdbcTemplate.queryForObject(select ID from table", Integer.class);

But the first one seems more compact. Maybe the only usage I could think for jdbcTemplate would be to call a stored procedure...can someone help me to better understand?

0 Answers
Related