Invalid paths element configured

I briefly, have this entity relations.

@Indexed
 class UserGroup {
    @IndexedEmbedded(includeEmbeddedObjectId = false, includePaths = {"defaultUserPosition1.user.id"})
    Collection<SocialGroup> socialGroupCollection;
}

class SocialGroup extends SocialEntity{
}

class SocialEntity{
    UserPosition defaultUserPosition1;
}

class UserPosition{
      User user;
}

class User{
      Integer id;
}


And I have this error.

Found invalid @IndexedEmbedded->paths elements configured for member ‘socialGroupCollection’ of class ‘UserGroup’. The invalid paths are [socialGroupCollection.defaultUserPosition1.user.id]

Should I use targetElement? how?

@Indexed
 class UserGroup {
    @IndexedEmbedded(includeEmbeddedObjectId = false, includePaths = {"defaultUserPosition1.user.id"})
    Collection<SocialGroup> socialGroupCollection;
}

class SocialGroup extends SocialEntity{
}

class SocialEntity{
    @IndexedEmbedded(includeEmbeddedObjectId = false,includePaths = {"user.id"})
    UserPosition defaultUserPosition1;
}

class UserPosition{
    @IndexedEmbedded(includeEmbeddedObjectId = true, includePaths = {"id"})
      User user;
}

class User{
      @NumericField
      Integer id;
}

I should use @IndexEmbeded in all nested fields.
My problem Solved. :slight_smile:

Now, should I use @ContainedIn in every nested class on the way to the Indexed(UserGroup) entity from User?
If I want to keep track of User changes.

If you want UserGroup to be reindexed when User changes, yes, you’ll need a @ContainedIn from User to UserPosition, from UserPosition to SocialEntity and from SocialGroup to UserGroup.

1 Like