I have 3 entities like:
Code:
User Group Permission
id id id
name ... name
... User ...
Set<Group> groups Permission Set<Group> groups
I want to search for User entites but with the name of a Permission entity (i.e. if the user types a name of a Permission then all the users should be enlisted that have that Permission via the Group entity)
I have a solution how to connect 2 entities (using indexEmbedded and containedIn) but no clue what to do when there are 3 entities. I did something like:
Code:
indexedMapping
.property("groups", ElementType.METHOD)
.indexEmbedded()
.prefix("group.")
.depth(2)
.targetElement(Group.class);
super.entity(Group.class)
.property("name", ElementType.FIELD)
.field()
.property("user", ElementType.FIELD)
.containedIn()
.property("permission", ElementType.METHOD)
.indexEmbedded()
.depth(1)
.prefix("permission.")
.targetElement(Permission.class);
super.entity(Permission.class)
// .property("name", ElementType.METHOD)
// .containedIn()
.property("name", ElementType.FIELD)
.field()
.store(Store.YES) ;
I want to change the index if the Persmission name is changed. I wanted to put the containedIn on the name but it is not an entity but there isn't entity in Permission only Set<Profile>. Well I tried to put the containedIn there but I got a NullPointerException.
Could somebody help please?
Thanks, V.