-->
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.  [ 5 posts ] 
Author Message
 Post subject: Another hibernate search problem w/ inhertance
PostPosted: Tue Dec 22, 2009 6:45 pm 
Beginner
Beginner

Joined: Mon Dec 21, 2009 3:43 pm
Posts: 24
using hibernate-search 3.0.1.GA

I have a same problem as may others have had when trying to get indexing setup with all the fields I want when I am using inheritance.

Simple Example:

Container entity (i.e. entity that contains all other entities) I want to store the ID of this entity to be indexed off of. Meaning when searching I want this entities ID to be returned.
IMPORTANT - this is where things break this class has a set of base class entities, where nothing in the base class is really a field, only elements within the subclasses have fields.
Code:
@Entity
@Indexed(index = "someText")
@Table(name = "A")
public class A implements java.io.Serializable {

   @Id
   @DocumentId // lucene index id
   @Column(name = "ID", unique = true, nullable = false, scale = 0)
   public long getId() {
      return this.id;
   }

   private Set<ParentB> parentItems= new HashSet<ParentB>(0);
   @IndexedEmbedded
   @OneToMany(fetch = FetchType.LAZY, mappedBy = "a", cascade = CascadeType.ALL)
   public Set<TextItem> getTextItems() {
      return this.textItems;



This is the parent entity (in this example this is the set of entities in my container above).
NOTE: there is really nothing in this class having to do with hibernate search. (Should there be????)
Code:
Entity
@Table(name = "B")
@Inheritance(strategy=InheritanceType.JOINED)
public class ParentB implements java.io.Serializable {

  // mapping to map back to container class
  private A a;


This is a child entity extending the parent - NOTE this is the class with the fields to be indexed.
Code:
@Entity
@Table(name="C")
public class ChildC extends ParentB {
.
.
    // This is some string value that I want to index
    // When I search for this string I want the ID from the container class in this example to be returned
    @Column(name="VALUE", nullable=false)
    @Field(index=Index.TOKENIZED)
    public String getValue() {
        return this.value;
    }


Notice that neither the parent or child class have @Indexed. Do they need to have this? If so do I just put them in the same index? (i.e. @Indexed(index = "someText")? Do I need @Contained in anywhere (I don't think so, but I don't really understand what this does.

So why is there nothing created in my index when I view it with Luke????


Top
 Profile  
 
 Post subject: Re: Another hibernate search problem w/ inhertance
PostPosted: Wed Dec 23, 2009 6:39 pm 
Beginner
Beginner

Joined: Mon Dec 21, 2009 3:43 pm
Posts: 24
Anyone have any ideas?????? Please help


Top
 Profile  
 
 Post subject: Re: Another hibernate search problem w/ inhertance
PostPosted: Mon Dec 28, 2009 9:52 am 
Beginner
Beginner

Joined: Mon Dec 21, 2009 3:43 pm
Posts: 24
I upgraded to Hibernate Search 3.1.1.GA and I am still seeing the same problem. Has anyone on the hibernate team tested indexing with inheritance? Please help!


Top
 Profile  
 
 Post subject: Re: Another hibernate search problem w/ inhertance
PostPosted: Mon Dec 28, 2009 12:08 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi, is this the same issue as reported in http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-438 ?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Another hibernate search problem w/ inhertance
PostPosted: Mon Dec 28, 2009 12:24 pm 
Beginner
Beginner

Joined: Mon Dec 21, 2009 3:43 pm
Posts: 24
Yes.

Unless of course there is something wrong with how I am using hibernate-search to create the index


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.