-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Search & Lucene & multiple related entities
PostPosted: Wed Sep 14, 2016 7:26 am 
Newbie

Joined: Wed Sep 14, 2016 7:13 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.