Unable to locate Attribute with the the given name [experience] on this ManagedType [com.studentManagement.model.Student]......this is error shown in console.
This is the code I did it in Specifcation class..
@Component
public class StudentSpecification {
public Specification<Student> getStudents(Student request){
return (root, query, criteriaBuilder) ->{
List<Predicate> predicates = new ArrayList<>();
if (request.getEmail() != null && !request.getEmail().isEmpty()) {
predicates.add(criteriaBuilder.equal(root.get("email"), request.getEmail()));
}
if (request.getFirstName() != null && !request.getFirstName().isEmpty()) {
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(root.get("firstName")),
"%" + request.getFirstName().toLowerCase() + "%"));
}
}
**Service Class**
public List getStudentList(Student request) {
List<Student> students=studentRepository.findAll(studentSpecification.getStudents(request));
return students;
}
I am expecting to print student details for particular student I searched
The error seems obvious enough.
Unable to locate Attribute with the the given name [experience] on this ManagedType [com.studentManagement.model.Student].
Your Student
object class doesn't have an attribute named with experience
.
Please check inside your student class and make sure you configure it correctly.