Spring Data Flashcards

1
Q

What is Spring ORM and Spring Data?

A

-Spring ORM:Object Relational Mapper
Module designed to integrate data access code into a spring app
-Spring Data: project by SpringSource with the intent to unify and ease the access to different kinds of persistent storage for both SQL, and nonSQL databases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Template design pattern and what is the JDBC template?

A

-Template design pattern is a pattern that encapsulates and supports similar algorithms to perform different kinds of business requirements by abstracting classes and allowing subclasses to determine concrete behavior.
-JDBCTemplate is a class that allows an object oriented way of executing queries to databases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does @Transactional do? What is the PlatformTransactionManager?

A

-We put @Transactional over our DAO methods, indicates that the methods should execute in a transactional context.
-Central interface in Spring’s transaction infrastructure, apps can use directly but is not meant to be an API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a PersistenceContext?

A

It handles a set of entities which are stored in a persistent store such as a database. The context is aware of different states of an entity within the context and the store itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain how to integrate Spring and Hibernate using ContextualSession

A

-You can use JPA annotation in bean classes to map beans to tables
-Implement DAO classes
-Use SessionFactory in DAO implementations to perform transactions
-Use beans xml to integrate beans with spring

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What interfaces are available in Spring Data JPA?

A

Repository
CrudRepository
PagingAndSortingRepository
JPARrepository

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between JPARepository and CrudRepository?

A

JPARepository extends PagingAndSortingRepository which extends CrudRepository and provides JPA related methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the naming conventions for methods in Spring Data repositories?

A

Follow Java naming conventions, an underscore _ can be used inside method name to manually define traversal points.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are Spring repositories implemented by Spring at runtime?

A

Uses SpringData REST to create an implementation of the repository interface automatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is @Query used for?

A

Used to define SQL to execute, allows us to execute SQL queries in an object oriented manner.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly