Tuesday, 14 March 2017

What are the ways to access Hibernate by using Spring?

There are two ways to access hibernate using spring:
  • Inversion of Control with a Hibernate Template and Callback.
  • Extending HibernateDAOSupport and Applying an AOP Interceptor node.

Which of the above transaction management type is preferable?

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.

What are the types of the transaction management Spring supports?

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.

How JdbcTemplate can be used?


With use of Spring JDBC framework the burden of resource management and error handling is reduced a lot. So it leaves developers to write the statements and queries to get the data to and from the database. JdbcTemplate 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.

How JDBC can be used more efficiently in spring framework?

JDBC can be used more efficiently with the help of a template class provided by spring framework called as JdbcTemplate.

What is @AspectJ? based aspect implementation?

@AspectJ refers to a style of declaring aspects as regular Java classes annotated with Java 5 annotations.

What is XML Schema based aspect implementation?

 Aspects are implemented using regular classes along with XML based configuration.