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) waiting for your answer 

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

Step: 3

blur-text-image

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago