-->
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: Search associated entities
PostPosted: Sat Jan 04, 2014 12:31 pm 
Newbie

Joined: Sat Nov 30, 2013 10:51 am
Posts: 3
Hi all,

in my project I have an ecore-model with several classes. I use Teneo to generate the Hibernate-mapping - this works fine. From that mapping I generate the Hibernate Search-mapping using the programmatic API.

A part of the generated mapping:
Code:
.entity([...].PersonImpl.class).indexed()
      .property("lastname", ElementType.METHOD).field()
      .property("firstname", ElementType.METHOD).field()
      .property("dateOfBirth", ElementType.METHOD).field().dateBridge(Resolution.DAY)
      .property("title", ElementType.METHOD).field()
      .property("participates", ElementType.METHOD).containedIn()
...

.entity([...].OrganisationImpl.class).indexed()
      .property("participants", ElementType.METHOD).indexEmbedded()
...



Both entities (Person and Organisation) extend the class InformationObject which has e.g. fields like "name" (which are mapped and indexed too).

The problem: If I try to search for participates.name (or any other reference) with following code:
Code:
QueryBuilder queryBuilder   =   fullTextSession.getSearchFactory()
                  .buildQueryBuilder().forEntity(Person.class).get();

org.apache.lucene.search.Query lq = queryBuilder.keyword()
                  .onFields("participates.name") .ignoreFieldBridge()
                  .matching(query).createQuery();

org.hibernate.search.FullTextQuery ftq = fullTextSession
                  .createFullTextQuery(lq, Organisation.class,
                  Person.class);

I receive an error: Unable to find field participates.name in [...].PersonImpl

Edit: The attribute particpates is of type EList<Organisation> (modifier: protected)

I do not know what is wrong with my implementation...

Thanks an advance!


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.