The problem is solved. Actually, there was an OneToMany relation from Class A to Class B. I changed the relation between those classes and put "JoinColumn" annotation on both of them. Code looks like below:
@Entity
@Indexed
public class ClassA {
@Id
@DocumentId
private Integer id1;
@Field
private Integer description;
@OneToMany(fetch=FetchType.EAGER, cascade = {CascadeType.ALL})
@IndexEmbedded
@JoinColumn(name="id1", referencedColumn="id1", updatable = false, insertable = false)
Set<ClassB> b;
// getters and setters
}
@Entity
public class ClassB {
@EmbeddedId
@DocumentId
private ClassB_Pk id;
@ContainedIn
@ManyToOne(fetch=FetchType.EAGER, cascade = {CascadeType.ALL})
@JoinColumn(name="id2", referencedColumnName="id2", insertable=false, updatable=false)
ClassA a;
// other properties
// setters and getters
}
@Embeddable
public class ClassB_Pk {
private Integer id1;
private Integer id2;
// getters and setters
}
Hope this helps to anybody who got stumbled upon on similar situation.