Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Custom Query Methods Consider the following code snippet that defines a Person entity class mapped with the Person table in the database. Based on this
Custom Query Methods
Consider the following code snippet that defines a Person entity class mapped with the Person table in the database. Based on this snippet, answer the questions given below.
@Entity public class Person { @Id @GeneratedValue private Integer id; private String firstName; private String lastName; private Integer age; //getters and setters; }
Which of the following are valid custom query methods that can be declared for this Entity class? (Note: More than one option may be correct.)
Hints:
- Let's say there is no field with the attribute name 'X' in the Person class. Then, the method's declaration findByX is invalid.
- Is the method declaration List
findByField(Integer entity1 AND Integer entity2) correct or List findByField(Integer entity1, Integer entity2) correct?
1) ListfindByLastName(String lastName)
2) ListfindByIdOrName(Integer id, String name)
3) ListfindByFirstName(String firstName)
4) ListfindByAgeBetween(Integer startAge AND Integer endAge)
Please give right solution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started