Ok, here is the exact situation.
To make it shorter, I dropped every getters, setters, etc.
Here is my Business Unit Entity :
Code:
@Entity
@Indexed
public class BusinessUnit implements Serializable {
private static final long serialVersionUID = 6381933189791412636L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, name = "BU_ID")
private Integer id;
@Column(name = "BU_ENNUMB", length = 100)
private String entityNumber;
@Column(name = "BU_MAIL", length = 200)
private String email;
@Column(name = "BU_WEB", length = 512)
private String website;
@Column(name = "BU_GSM", length = 20)
private String gsm;
@Column(name = "BU_TEL", length = 20)
private String tel;
@Column(name = "BU_FAX", length = 20)
private String fax;
@Column(name = "BU_VAL")
private Boolean validity;
@Column(name = "MODIFDATE")
private Date modifyDate;
@Column(name = "CREATIONDATE")
private Date creationDate;
// Associtations
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ARTINFO_ID")
@Fetch(FetchMode.JOIN)
@IndexedEmbedded
private ArtisanInfo artisanInfo;
// @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "businessUnit")
@CollectionOfElements(fetch = FetchType.EAGER)
@IndexedEmbedded
private Collection<BuAddress> addresses = new HashSet<BuAddress>();
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "KBOENTR_ID")
private KboEnterprise enterprise;
@ManyToMany
@JoinTable(name = "SELECTEDCAT", joinColumns = @JoinColumn(name = "BU_ID"), inverseJoinColumns = @JoinColumn(name = "CAT_ID"))
private Set<Categories> categories = new HashSet<Categories>();
...
}
And here is my BuAddress Entity:
Code:
@Entity
// @Indexed
public class BuAddress implements Serializable {
private static final long serialVersionUID = -1145537123252752661L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, name = "ADR_ID")
private Integer id;
@Column(name = "ADR_LANG", length = 5)
private String lang;
@Column(name = "ADR_RUE", length = 100)
@Field(store = Store.YES)
private String rue;
@Column(name = "ADR_NUM", length = 5)
private String numero;
@Column(name = "ADR_BTE", length = 5)
private String boite;
@Column(name = "ADR_CODE", length = 5)
private String codepostal;
@Column(name = "ADR_LOC", length = 5)
@Field
private String localite;
@Column(name = "ADR_PAY", length = 5)
private String pays;
// Associations
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "COMMUNE_ID")
@Fetch(FetchMode.JOIN)
@IndexedEmbedded
private Commune commune;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "BUSINESS_UNIT_ID")
@ContainedIn
private BusinessUnit businessUnit;
...
}
I left my comments for a better visibility.
You will see I make other IndexEmbedded in the BuAddress. Those are working fine if I remove the Index Embedded from the Business Unit. But I need to have all those indexes in my BusinessUnit Lucene's index ...
Romain.