-->
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: @IndexEmbedded and inheritance
PostPosted: Tue Dec 04, 2012 4:50 pm 
Newbie

Joined: Tue Dec 04, 2012 1:37 pm
Posts: 1
Hi

I'm using latest hibernate (4.1.7) and hibernate-search (4.1.1)
and i'm trying to index an entity containing another embedded
entity with inheritance.

Model is:

Code:
@Entity
@Indexed
public class Store {

   @Id
   private long id;

   @Field
   private String location;

   @IndexEmbedded
   private Product product;

}

@Embeddable
public abstract Product {
   @Id
   private long id;
}

@Embeddable
public class Book extends Product {

   @Field
   private String name;
}

@Embeddable
public class Movie extends Product {

   @Field
   private String title;
}


Only Store is indexed. The problem is that Store#pruduct in
not indexed and the only field present in lucene index are:
_hibernate_class
id
location

but "product.id" and "book.name" or "movie.title" are missing
depending on Store#product type.

Any clue about this problem ?


Top
 Profile  
 
 Post subject: Re: @IndexEmbedded and inheritance
PostPosted: Tue Jan 08, 2013 6:46 am 
Hibernate Team
Hibernate Team

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

your example is not working, because it is not possible to dynamically change the target type of an indexed association. In your case only Product gets considered which does not contain any indexed fields. If you for example make the id in Product indexable it should be in the index.

You can also set the targetElement of the IndexedEmbedded annotation, but that is a static configuration.

--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.