What is the starter for Spring JPA?
spring-boot-starter-data-jpa
What jars are inside Spring JPA?
What happens if Spring boot found JPA on the classpath?
It will auto-configure:
How to customize EntityManager?
Configure the bean LocalContainerEntityManagerFactoryBean and set:
What is the purpose of @EnableAutoConfiguration? Does it belong to spring framework or spring boot?
What beans will be scanned with @EnableAutoConfiguration?
In Spring Boot, how to customize the packages that will be scanned for entities?
Using @EntityScan e.g.
@SpringBootApplication
@EntityScan(“my.package”)
public class Application {}
Spring JPA: how to customize DB name?
spring.jpa.database=my-db-name
Spring JPA: how to disable the feature that creates tables automatically?
spring.jpa.hibernate.ddl-auto=none
What are options for spring.jpa.hibernate.ddl-auto? What is the default one?
none validate update create create-drop (default)
How to show SQL queries in a nice format?
spring. jpa.show-sql=true
spring. jpa.properties.hibernate.format_sql=true
How to set a custom property for Hibernate?
spring.jpa.properties.hibernate.xxx=…
What ORMs does Spring support?
Hibernate only
What are the benefits of using Spring data?
2. Works in many environments
List out 6 sub-projects of Spring Data
Motivation for Spring Data
How to define a repository?
What interfaces will be scanned for repositories?
Interfaces that extend Repository or CrudRepository
How to define an auto-increment id?
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
What is the annotation for domain class in MongoDB and Neo4j, Gemfire?
@Document - MongoDb
@NodeEntity - Neo4J
@Region - Gemfire
List out methods in Repository
It’s empty
List out 5 methods in CrudRepository
Describe PagingAndSortingRepository
Ways to implement the method to get the first 10 records?
2. findTop10ByField(field)