Bird
0
0

Given the following Spring Boot repository method call:

medium📝 Predict Output Q4 of 15
Spring Boot - Docker and Deployment
Given the following Spring Boot repository method call:
List users = userRepository.findByAgeGreaterThan(25);

What will this method return?
AAll users with age greater than 25
BAll users with age equal to 25
CAll users with age less than 25
DAn error because method name is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand Spring Data JPA query method naming

    Methods like findByAgeGreaterThan return entities where age is greater than the given value.
  2. Step 2: Interpret the method call

    The call with 25 returns users older than 25, not equal or less.
  3. Final Answer:

    All users with age greater than 25 -> Option A
  4. Quick Check:

    findByAgeGreaterThan(25) = users older than 25 [OK]
Quick Trick: Method names define query behavior in Spring Data JPA [OK]
Common Mistakes:
  • Assuming equals instead of greater than
  • Confusing less than with greater than
  • Thinking method name is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes