Bird
0
0

You have this Spring Boot repository method:

medium📝 Debug Q6 of 15
Spring Boot - Docker and Deployment
You have this Spring Boot repository method:
List findByStatus(String status);

But calling findByStatus(null) throws an error. What is the likely cause?
AThe database column 'status' is not nullable
BSpring Data JPA does not allow null parameters in query methods
CThe method name is incorrect for null values
DThe repository interface is missing @Repository annotation
Step-by-Step Solution
Solution:
  1. Step 1: Understand Spring Data JPA query parameter rules

    Spring Data JPA query methods do not accept null parameters by default and throw errors if null is passed.
  2. Step 2: Exclude other causes

    Method name is correct, @Repository is optional on interfaces, and DB nullability does not cause this error.
  3. Final Answer:

    Spring Data JPA does not allow null parameters in query methods -> Option B
  4. Quick Check:

    Null parameters cause errors in query methods [OK]
Quick Trick: Avoid null in Spring Data JPA query parameters [OK]
Common Mistakes:
  • Assuming database null constraints cause this error
  • Thinking method name must change for null
  • Believing @Repository annotation is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes