Answered step by step
Verified Expert Solution
Link Copied!

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) List findByLastName(String lastName) 

2) List findByIdOrName(Integer id, String name) 

3) List findByFirstName(String firstName) 

4) List findByAgeBetween(Integer startAge AND Integer endAge) 

Please give right solution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

=+ 2. How is the Phillips curve related to aggregate supply?

Answered: 1 week ago