-->
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.  [ 8 posts ] 
Author Message
 Post subject: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 10:12 am 
Regular
Regular

Joined: Thu Nov 26, 2009 8:45 am
Posts: 78
Hi,

im tryin' to index an object which has attributes of class a, b, and c, something like:
Code:
@indexed
@entity
class topclass(){

   @IndexedEmbedded
   A instanceA = null;
   @IndexedEmbedded
   B instanceB = null;
   @IndexedEmbedded
   Set<C> setOfC = null;
   ...
}


A and B been indexed correctly, but theres no index created for class C. Anybody could tell me why?

Thx.

(edit: still using hs 3.0.1)


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 10:39 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
What do you mean with "there is no index created for this class"? Like a physical index on the file system. If the embedded entity is not itself annotated with @Indexed there won't be an additional index directory.
Or do you mean the entities are not searchable? Have you inspected the index for TopClass with Luke? In case the Lucene Documents really don't contain any information for class C it would help if you post the code for your annotated entities together with the code on how you index them and how you try to search. Just looking at the generic usecase you are describing it should work.

--Hardy


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 10:47 am 
Regular
Regular

Joined: Thu Nov 26, 2009 8:45 am
Posts: 78
The entities are not searchable. Luke doesnt offer me the fields of C if i inspect the index of topclass.
The point is, C is just an interface, which some other classes (annotated as @Entity) are implementing.
I index the classes the following way:
Code:
fSession.beginTransaction();
List<topclass> topList = dbSession.createCriteria(topclass.class).list();
for(topclass tc : topList){
   fSession.index(tc);
}
fSession.getTransaction().commit();
fSession.close();


Am i missing something about the interface issue?


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 10:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Can you show/post the annotated classes?


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 11:10 am 
Regular
Regular

Joined: Thu Nov 26, 2009 8:45 am
Posts: 78
topclass:
Code:
@Indexed
@Entity
public abstract class topclass implements Serializable {

   @DocumentId
   private Integer      id            = null;

        @IndexedEmbedded
        private A someA                                  = null;
        @IndexEmbedded
        private B someB                                   = null;
         ....
   @IndexedEmbedded
   private Set<C>      notizen      = new HashSet<C>();
        ...

interface C:
Code:
@Entity
public interface C {
   @DocumentId
   public Integer getId();
   @Field
   public String getText();
        ...

class implementing C:
Code:
@Indexed
@Entity
public abstract class someOtherClass implements C, Serializable {

   private static final long serialVersionUID = 1L;
   
   @DocumentId
   private Integer id = null;
   @Field(index=Index.UN_TOKENIZED, store=Store.YES)
   private String text = null;
        ...

class extending someOtherClass:
Code:
@Entity
public class someFinalClass extends someOtherClass {

   private static final long serialVersionUID = 1L;

   @IndexedEmbedded
   private someAttrib sab = null;
        ...


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 22, 2009 12:44 pm 
Regular
Regular

Joined: Thu Nov 26, 2009 8:45 am
Posts: 78
ok, after debugging all afternoon, i figured it out. missed something in the annotations, all my fault. isnt that easy when you got more than a hundred classes to index. thx anyway


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Mon Nov 29, 2010 9:18 am 
Newbie

Joined: Fri Feb 24, 2006 9:15 am
Posts: 17
Hello,

could you share with us what modifications you made to make it work? I'm thying to make something similar work, but without succes, it would be nice if you case could give me a hint...

Regards Bo


Top
 Profile  
 
 Post subject: Re: using indexembedded with Set<class>
PostPosted: Tue Dec 21, 2010 7:32 am 
Regular
Regular

Joined: Thu Nov 26, 2009 8:45 am
Posts: 78
if i remember correctly, the interface implementing class did contain a reference to the class it was instanciated in. So i had to made use of the "@ContainedIn" annotation.
But its long ago i did that, not sure if it was exactly that one, sorry.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.