-->
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.  [ 2 posts ] 
Author Message
 Post subject: @OneToMany
PostPosted: Mon Feb 02, 2009 12:13 pm 
Newbie

Joined: Tue Jan 15, 2008 7:12 am
Posts: 2
Hello friends, I'm trying to use hibernate search and I like it a lot, but when I use the @ContainedIn annotation to map a @OneToMany field I don't get the right return in the search.

My field is this:
Code:
@ContainedIn
   public Set<PalavraChave> getPalavraschave() {
      return palavraschave;
   }

and my object 'PalavraChave' is annotated with the @Indexed, @DocumentId and @Field annotations, but when I try to search like this:

Code:
String[] fields = new String[]{"nomePopular", "palavraschave.descricao"};
      MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
      Query query = parser.parse(nome);
      //FullTextQuery ftq = fullTextEntityManager.createFullTextQuery(query, PalavraChave.class);
      FullTextQuery ftq = fullTextEntityManager.createFullTextQuery(query, Servico.class);
      teste = ftq.getResultList();

The search doesn't return any object, and when I try to search by the 'nomePopular' (String), the return was right.

So, What am I doing wrong?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2009 10:47 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I think you are just mixing up things. You should use @IndexedEmbedded on the set and use @ContainedIn within PalavraChave (on the inverse side), provided that your mapping has an inverse side.

--Hardy


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

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.