Spring Data Access interview question

1. How can JDBC be used more efficiently in the Spring framework? 
When using the Spring JDBC framework the burden of resource management and error handling is reduced. So developers only need to write the statements and queries to get the data to and from the database. JDBC can be used more efficiently with the help of a template class provided by Spring framework, which is the JdbcTemplate (example here).

2. JdbcTemplate: JdbcTemplate class provides many convenience methods for doing things such as converting database data into primitives or objects, executing prepared and callable statements, and providing custom database error handling.

3. Spring DAO support: The Data Access Object (DAO) support in Spring is aimed at making it easy to work with data access technologies like JDBC, Hibernate or JDO in a consistent way. This allows us to switch between the persistence technologies fairly easily and to code without worrying about catching exceptions that are specific to each technology.

4. What are the ways to access Hibernate by using Spring? 
There are two ways to access Hibernate with Spring: Inversion of Control with a Hibernate Template and Callback. Extending HibernateDAOSupport and Applying an AOP Interceptor node.

5. ORM’s Spring support: Spring supports the following ORM’s: Hibernate iBatis JPA (Java Persistence API) TopLink JDO (Java Data Objects) OJB

6. How can we integrate Spring and Hibernate using HibernateDaoSupport? 
 Use Spring’s SessionFactory called LocalSessionFactory. The integration process is of 3 steps: Configure the Hibernate SessionFactory Extend a DAO Implementation from HibernateDaoSupport Wire in Transaction Support with AOP

7. Types of the transaction management 
Spring support Spring supports two types of transaction management: Programmatic transaction management: This means that you have managed the transaction with the help of programming. That gives you extreme flexibility, but it is difficult to maintain. Declarative transaction management: This means you separate transaction management from the business code. You only use annotations or XML based configuration to manage the transactions.

8. What are the benefits of the Spring Framework’s transaction management? 
 It provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, JPA, and JDO. It provides a simpler API for programmatic transaction management than a number of complex transaction APIs such as JTA. It supports declarative transaction management. It integrates very well with Spring’s various data access abstractions.

9. Which Transaction management type is more preferable? 
Most users of the Spring Framework choose declarative transaction management because it is the option with the least impact on application code, and hence is most consistent with the ideals of a non-invasive lightweight container. Declarative transaction management is preferable over programmatic transaction management though it is less flexible than programmatic transaction management, which allows you to control transactions through your code.

Web School BD

বাংলাদেশের প্রথম অনলাইন ভিত্তিক ট্রেনিং সেন্টার "Web School BD". ওয়েব স্কুল বিডি : https://www.webschool.com.bd

Post a Comment

আপনার কোন কিছু জানার থাকলে কমেন্টস বক্স এ লিখতে পারেন। আমরা যথাযত চেস্টা করব আপনার সঠিক উত্তর দিতে। ভালো লাগলে ধন্যবাদ দিতে ভুলবেন না। শিক্ষার্থীরা নোট ,সাজেশান্স ও নতুন নতুন ভিডিও সবার আগে পেতে আমাদের Web School BD চ্যানেলটি সাবস্ক্রাইব SUBSCRIBE করতে পারো।
- শুভকামনায় ওয়েব স্কুল বিডি

Previous Post Next Post