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