-->
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: INHERITANCE and abstract classes mapping forHibernate-Search
PostPosted: Wed Oct 28, 2009 5:58 am 
Newbie

Joined: Tue Oct 27, 2009 12:02 pm
Posts: 2
I'm having problems with hibernate-search and the indexing of these classes. The attributes of the specialized classes are not indexed. Is there any problem with this mappings???

This is the class diagram and annotations.

Code:
@Entity
@Indexed
@Inheritance
@DiscriminatorColumn(name="thirdType")
public abstract class Third implements Serializable {

   @DocumentId
   private Long id;
   
   @Field(index=Index.TOKENIZED, store=Store.YES)
   private String identificationCardNumber;
   
   @OneToMany
   @IndexedEmbedded(depth=100)
        @JoinTable(
            name="ThirdAddresses",
            joinColumns = @JoinColumn( name="thirdId"),
            inverseJoinColumns = @JoinColumn( name="addressId")
         )
        @Cascade({CascadeType.SAVE_UPDATE ,CascadeType.DELETE_ORPHAN})
        @LazyCollection(LazyCollectionOption.FALSE)
   private Set<Address> addresses;

        public Third() {}

.......................


Third has a set of addresses and Address is an abstract class (defined below). Also, Third has children like ThirdPhysical.............

Code:
@Entity
@Indexed
@DiscriminatorValue("Physical")
public class ThirdPhysical extends Third implements Serializable {
   
   @Field(index=Index.TOKENIZED, store=Store.YES)
   private String name;   
   
   @Field(index=Index.TOKENIZED, store=Store.YES)
   private String surname;
   
   
   public ThirdPhysical() {
   }

........................
[/i]

Address is an abstract class like Third

Code:
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
@DiscriminatorColumn(name="addressType")
@Embeddable
public abstract class Address implements Serializable {
   
   @Id   
   @DocumentId
   @GeneratedValue(strategy = GenerationType.TABLE)
   @Column(name = "addressId")
   private Long id;   
      
   private boolean preference;
   
   public Address() {}
.......................................



Address has children like EmailAddress ..........

Code:
@Entity
@DiscriminatorValue("Email")
@Indexed
public class EmailAddress extends Address implements Serializable {

   @Field(index=Index.TOKENIZED, store=Store.YES)
   private String email;

   private Boolean notification;
   
   public EmailAddress() {   }

....................................



The problem is that the index is only for the Third attributes and the id attribute of the Address class. There's no indexation for emailAddress .....


Do you have any idea??

Thanks in advance


Top
 Profile  
 
 Post subject: Re: INHERITANCE and abstract classes mapping forHibernate-Search
PostPosted: Wed Oct 28, 2009 7:27 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Sorry I'm not seeing what's wrong in your mapping. Would you be able to provide a testcase? I'd be happy to look into it.
Please open an issue on JIRA and attach the testcase, it's very simple to make a test, have a look into org.hibernate.search.test.id.ImplicitIdTest for something similar:

http://fisheye.jboss.org/browse/Hibernate/search/trunk/src/test/java/org/hibernate/search/test/id/ImplicitIdTest.java?r=17630

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


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.