jpa IllegalArgumentException exception

Posted by Bunny Rabbit on Stack Overflow See other posts from Stack Overflow or by Bunny Rabbit
Published on 2010-04-22T13:01:38Z Indexed on 2010/04/22 13:03 UTC
Read the original article Hit count: 541

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about jpa

Related posts about google-app-engine