Topic:   How to find an object by spring data nested property? got this error.
Sep 08, 2021 11:12 2 Replies 54 Views SANJAY

How to find an object by spring data nested property? I got this error.

"Invalid derived query! No property parentId found for type Car!" Any work around? Here is the code

public interface CarRepository extends MongoRepository{

Car findByParentId(Long parentId); // ERROR:

}

class Car{

private Offer offer;

//getter setter

}

class Offer{

private Long parentId;

//getter,setter

}

Prev Next
Topic Replies (2)
  1. 1
    idnkx user

    VAMSI

    How would Car find By ParentId (Long parentId); // ERROR: possibly work? A Car has no field 'parentID'.

    1
    idnkx user

    SANJAY

    yes. I know. but What's the solution to this ? How to solve this when you want to find by a nested property like above.

Leave a Reply
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect