• Tutorials
  • Courses
  • Tracks

Advanced Java Quiz Day 54

Last Updated :
Discuss
Comments

Question 1

In a Spring Boot application, which dependency is commonly used to integrate JPA and Hibernate?

  • spring-boot-starter-hibernate

  • spring-boot-starter-data-jpa

  • spring-boot-starter-jdbc

  • spring-boot-starter-sql

Question 2

Which ORM provider is used by default when you use Spring Data JPA in Spring Boot?

  • EclipseLink

  • TopLink

  • Hibernate

  • MyBatis

Question 3

What is the main purpose of JpaRepository in Spring Data JPA?

  • To provide Hibernate-specific APIs only

  • To perform CRUD operations and JPA-specific features

  • To manage database migrations

  • To store database connection properties

Question 4

Which of the following methods is not inherited from JpaRepository?

  • findAll()

  • save()

  • deleteById()

  • getConnection()

Question 5

Which annotation is used in Spring Data JPA to write a custom JPQL query?

  • @JPQL

  • @Query

  • @Select

  • @JPQLQuery

Question 6

What does JPQL (Java Persistence Query Language) operate on?

  • Database table names and columns

  • Entity objects and their properties

  • Raw database schemas

  • JSON data only

Question 7

Which of the following is a correct JPQL query to fetch all users with a specific last name?

  • SELECT * FROM User WHERE last_name = ?1

  • SELECT u FROM User u WHERE u.lastName = ?1

  • FROM users WHERE lastName = ?1

  • FETCH u FROM User u WHERE lastName = ?1

Question 8

If you want to run a native SQL query inside a Spring Data JPA repository method, what must you do?

  • Use @NativeQuery annotation

  • Use @Query annotation with nativeQuery = true

  • Write query in application.properties

  • Override EntityManager manually

Question 9

When integrating Hibernate with Spring Boot, which property in application.properties is used to automatically create/update the database schema?

  • spring.jpa.hibernate.auto-schema

  • spring.jpa.hibernate.ddl-auto

  • spring.datasource.schema-update

  • hibernate.ddl

Question 10

Which of the following is true about JpaRepository?

  • It supports pagination and sorting

  • It can only be used for SELECT queries

  • It requires writing all SQL queries manually

  • It is only available in Spring Boot 3+

There are 10 questions to complete.

Take a part in the ongoing discussion