Spring MCQ Quiz Hub

Spring Mcq Set 12

Choose a topic to test your knowledge and improve your Spring skills

1. For mapping and persisting your objects with Hibernate and JPA.




2. Core Programming Elements for Different Data Access Strategies.




3. Interface whose instances can be obtained from a SessionFactory instance.




4. Interface whose instances can be obtained from an EntityManagerFactory instance.




5. The exceptions thrown by Hibernate are of type HibernateException, while those thrown by JPA may be of type PersistenceException.




6. To accept a session factory via dependency injection.




7. Property for factory bean to load the Hibernate configuration file.




8. If you want to use this data source for your session factory, you can inject it into the dataSource property of LocalSessionFactoryBean.




9. FactoryBean to create an entity manager factory in the IoC container.




10. It allows you to override some of the configurations in the JPA configuration file.




11. Spring HibernateTemplate can simplify your DAO implementation by managing sessions and transactions for you.




12. An alternative to Spring HibernateTemplate is:-




13. Sessionfactory can manage contextual sessions for you and allows you to retrieve them by the:-




14. DAO methods require access to the session factory, which can be injected:-




15. DAO methods must be made transactional.




16. Annotation to find a transaction and then fail, complaining that no Hibernate session been bound to the thread.




17. In the bean configuration file for Hibernate (i.e., beans-hibernate.xml), you have to declare a HibernateTransactionManager instance for this application and enable declarative transaction via:-




18. HibernateTemplate will translate the native Hibernate exceptions into exceptions in Spring DataAccessException hierarchy.




19. Annotation for Hibernate exceptions to be translated into Spring DataAccessException for consistent exception handling:-




20. Instance to translate the native Hibernate exceptions into data access exceptions in Spring DataAccessException hierarchy.




21. You can assign a component name in this annotation and have the session factory autowired by the Spring IoC container with @Autowired.




22. Spring provides to simplify your DAO implementation by managing entitymanagers and transactions for you:-




23. Annotation used for entity manager injection in EJB components.




24. To use the context injection approach, you can declare an entity manager field in your DAO and annotate it with the @PersistenceContext annotation.




25. JpaTemplate will translate the native JPA exceptions into exceptions in Spring DataAccessException hierarchy.




26. Transactions can be described with key properties:-




27. To access a database running on the Derby server, you have to add:-




28. Spring’s transaction support offers a set of technology-independent facilities, including transaction managers.




29. Spring’s core transaction management abstraction is based on the interface:-




30. The PlatformTransactionManager interface provides methods for working with transactions:




31. Spring has several built-in implementations of PlatformTransactionManager interface for use with different transaction management APIs.




32. A transaction manager is declared in the Spring IoC container as a normal bean.




33. Method that allows you to start a new transaction (or obtain the currently active transaction).




34. PlatformTransactionManager is an abstract unit for transaction management.




35. Method to start a new transaction with that definition:-




36. To help you control the overall transaction management process and transaction exception handling.




37. You just have to encapsulate your code block in a callback class that implements the TransactionCallback interface and pass it to the TransactionTemplate execute method for execution. In this way, you don’t need to repeat the boilerplate transaction management code for this block.




38. A TransactionTemplate can accept a transaction callback object that implements:-




39. Spring (since version 2.0) offers a transaction advice that can be easily configured via the:-




40. You can omit the transaction-manager attribute in the element if your transaction manager has the name transactionManager.




41. A transaction propagation behavior can be specified by the:-




42. Transaction propagation behavior are defined in the:-




43. If there’s an existing transaction in progress, the current method should run within this transaction.




44. The current method must start a new transaction and run within its own transaction.




45. If there’s an existing transaction in progress, the current method can run within this transaction.




46. The current method should not run within a transaction.




47. The current method must run within a transaction.




48. The current method should not run within a transaction. If there’s an existing transaction in progress, an exception will be thrown.




49. If there’s an existing transaction in progress, the current method should run within the nested transaction.




50. For two transactions T1 and T2, T1 reads a field that has been updated by T2 but not yet committed.