Interview Questions: Spring Framework JDBC
June 12, 2013
Qns-1: In complete life cycle of JDBC, what roles are played by Spring JDBC? |
Ans: Spring does following things: a. Opens connection b. Prepare and execute statement. c. Iterate the results d. Process exception if any e. Handle transaction f. Close connection |
Qns-2: What template does Spring JDBC provide to access database? |
Ans: Following template is provided. a. a. JdbcTemplate b. b. NamedParameterJdbcTemplate c. c. SimpleJdbcTemplate |
Qns-3: What are native NativeJdbcExtractor in Spring? |
Ans: a. SimpleNativeJdbcExtractor b. C3P0NativeJdbcExtractor c. CommonsDbcpNativeJdbcExtractor d. JBossNativeJdbcExtractor |
Qns-4: What annotation is used to configuring DAO in Spring? |
Ans: Write @Repository at class level. Entity manager can be configured by @PersistenceContext at property level. |