Maya More wrote:Hi,
I want to execute a "select " query. Say fetch employee details from a employee table.
What are steps and calls to be made to execute using jdbcTemplate and hibernateTemplate.
Thanks
Meena
Well, if I was using Hibernate, I don't use the template, I inject a SessionFactory into my Repository/DAO and write straight Hibernate code.
If I was using
Jdbc, then I definitely would use the JdbcTemplate. That template has methods to run queries, where you pass in the SQL statement as a
String and if you have parameters in the Query string, then pass those values in to the method of the template. If you want a domain object back, then you implement one of Spring's Callback interface like RowMapper or ResultSetExtractor.
For more information, I highly recommend reading the Spring documentation at www.springframework.org
Mark