click below
click below
Normal Size Small Size show me how
Spring Data
Question | Answer |
---|---|
What Object Relational Mappers does Spring support ? | Spring supports the following ORMs : ● Hibernate ● iBatis ● JPA (Java Persistence API) ● TopLink ● JDO (Java Data Objects) ● OJB |
What are some types of transaction propagation in Spring? | Transaction Propagation is the ability to decide how methods should encapsulate transactions. In short, propagation is an attribute inside of @Transactional annotation. |
What are some types of transaction propagation in Spring? 1 of 5 | Mandatory, never, nested, not supported, supports, required, requires new, and timeout default. To illustrate the concept: Mandatory- Supports a current transaction; throws an exception if no current transaction exists. |
What are some types of transaction propagation in Spring? 2 of 5 | Never- Does not support a current transaction; throws an exception if a current transaction exists. Not-Supported - Does not support a current transaction; rather always execute nontransactionally. |
What are some types of transaction propagation in Spring? 3 of 5 | Supports- Supports a current transaction; executes non-transactionally if none exists. Required- Supports a current transaction; creates a new one if none exists. |
What are some types of transaction propagation in Spring? 4 of 5 | Requires new- Creates a new transaction, suspending the current transaction if one exists. Nested- Executes within a nested transaction if a current transaction exists. |
What are some types of transaction propagation in Spring? 5 of 5 | Timeout default- Uses the default timeout of the underlying transaction system, or none if timeouts are not supported. |
What module of Spring Data have we used to have our repository implementation automatically provided for us through our repository interfaces. | We have used the spring-data-jpa module is used to implement JPA-based repositories. |
What interface can you extend through your repository interfaces to provide standard CRUD operations? | extend CrudRepository<ClassName, IdDataType> |
What are some advantages of using Spring Data? 1 of 4 | Powerful repository and custom object-mapping abstractions Dynamic query derivation from repository method names |
What are some advantages of using Spring Data? 2 of 4 | In other words, Spring Data creates all your dao method implementations for you. All you have to do is create an interface then extends CrudRepository<MyObject, Integer>. |
What are some advantages of using Spring Data? 3 of 4 | Spring Data will automatically create your basic crud methods. |
What are some advantages of using Spring Data? 4 of 4 | If the application needs more than just crud methods then create method declarations inside of your interface and Spring data will do the rest; the methods have to follow a naming convention defind in Spring Data's documentation. |
What is Spring Data? | Spring Data is a Spring-based programming model for data access |
What does @Transactional do in Spring ORM? | @Transactional tells Spring that the method or class creates transactions. Spring will then create and manage your sessions and commits for you. |
What is a contextual session? | ContextualSession is a hibernate functionality. It maps a current session to a specific user's content. |
What three beans do you need to create in your beans.xml to set up Hibernate with Spring ORM. 1 of 3 | You need your "dataSource", "sessionFactory", and "TransactionManager". Datasource will contain your database location and credentials (jdbc driver, URL, username, and password) |
What three beans do you need to create in your beans.xml to set up Hibernate with Spring ORM. 2 of 3 | SessionFactory takes your dataSource as a dependency. It also contains the configurations that would have normally be put inside of the hibernate.cfg.xml. SessionFactory is a hibernate instance. |
What three beans do you need to create in your beans.xml to set up Hibernate with Spring ORM. 3 of 3 | TransactionManager takes your sessionFactory as a dependency. The transaction manager is responsible for contexual sessions. The transaction manager is a Hibernate instance. |
What is Spring ORM? | Spring Object Relational Mappers is a spring module that allows Spring to manage another ORM framework in your place. In our case, we let Spring ORM manage Hibernate. |