i've three entity classes in my project
public class Blobx {
@ManyToOne
private Userx user;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;
}
public class Index {
@Id
private String keyword;
@OneToMany(cascade = CascadeType.PERSIST)
private List<Blobx> blobs;
}
public class Userx {
@Id
private String name;
@OneToMany(mappedBy = "user")
private List<Blobx>blobs;
}
while running the following lines app engine throws an exception
em.getTransaction().begin();
em.persist(index);
em.getTransaction().commit();//exception is thrown
em.close();
as
Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element
{
type: "Index"
name: "function"
}
and Element {
type: "Userx"
name: "18580476422013912411"
}
i can't understand what's wrong?