Hi,

Look at

http://gae-java-persistence.blogspot.com/2009/10/executing-batch-gets.html

&

http://gae-java-persistence.blogspot.com/2009/10/optimistic-locking-with-version.html

regards

didier

On Mar 4, 1:45 pm, lisandrodc <lisandr...@gmail.com> wrote:
> Hi Didier!...
> To what part of the blog do you you recount that it is associated with
> my worry?
> Regards
> Lisandro
>
> On Feb 28, 2:40 am, Didier Durand <durand.did...@gmail.com> wrote:
>
> > Sorry,
>
> > Got confused with Objectify that I use now in place of JDO/JPA.
>
> > Look at this blog:http://gae-java-persistence.blogspot.com/
>
> > You have there the needed examples to solve your problem
>
> > regards
>
> > didier
>
> > On Feb 27, 2:53 pm, lisandrodc <lisandr...@gmail.com> wrote:
>
> > > Thanks Didier, but "@Parent" It is not an annotation of JPA...
> > > link:http://www.datanucleus.org/products/accessplatform_1_1/jpa/annotation...
> > > What is what you say that I must place in the code?
>
> > > Regards
> > > Lisandro
>
> > > On 27 feb, 04:06, Didier Durand <durand.did...@gmail.com> wrote:
>
> > > > Yes,
>
> > > > You can't update 2 entities that are not related by a parent (@Parent)
> > > > - child relationship in a single transaction else GAE creates them in
> > > > 2 separate entity groups and then throws an exception because a
> > > > transaction can't update objects in more than 1 entity group.
>
> > > > See parag Entity Groups 
> > > > inhttp://code.google.com/appengine/docs/java/datastore/transactions.html
>
> > > > regards
>
> > > > didier
>
> > > > On Feb 26, 8:49 pm, lisandrodc <lisandr...@gmail.com> wrote:
>
> > > > > Hi ! I have an error at update an object:
>
> > > > > public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) {
>
> > > > >                 EntityTransaction et= em.getTransaction();
> > > > >                 try {
> > > > >                         et.begin();
> > > > >                         ControladorGrupoTorneo cGT = new 
> > > > > ControladorGrupoTorneo();
> > > > >                         GrupoTorneo grTorneo = 
> > > > > cGT.devolverGrupoTorneo(idGrupo);
> > > > >                         usuario.agregarGrupoTorneo(grTorneo);
> > > > >                         em.merge(usuario);
> > > > >                         et.commit();
> > > > >                        //the exception at commit;
> > > > >                         
> > > > > System.out.println("persistioUsuarioConGrupo");
> > > > >                 } finally {
>
> > > > > The error is:
>
> > > > > Caused by: java.lang.IllegalArgumentException: can't operate on
> > > > > multiple entity groups in a single transaction. found both Element {
> > > > >   type: "GrupoTorneo"
> > > > >   id: 3}
>
> > > > >  and Element {
> > > > >   type: "Usuario"
> > > > >   id: 11
>
> > > > > }
>
> > > > > Class Usuario:
>
> > > > > @Entity
> > > > > public class Usuario {
> > > > >         @Id
> > > > >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > > >         private Key id;
>
> > > > >         private String nombreUsuario;
>
> > > > >         private String nombre;
>
> > > > >         private String apellido;
>
> > > > >         private String telefono;
>
> > > > >         private String password;
>
> > > > >         private String mail;
>
> > > > >         private String imagen;
>
> > > > >         private String ciudad;
>
> > > > >         private String pais;
> > > > >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> > > > >                                     CascadeType.REFRESH, 
> > > > > CascadeType.MERGE})
> > > > >         private List<RegFechaUsuario> listRegFechaUsuario;
> > > > >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> > > > >                     CascadeType.REFRESH, CascadeType.MERGE})
> > > > >         private List<GrupoTorneo> gruposTorneo;
> > > > >     /**
> > > > > ....
>
> > > > > Class GrupoTorneo:
>
> > > > > @Entity
> > > > > public class GrupoTorneo  {
> > > > >         @Id
> > > > >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > > >         private Key id;
>
> > > > >         private String nombre;
>
> > > > >         private String descripcion;
>
> > > > >         private Date fechaCreacion;
>
> > > > >         private Long idTorneo;
>
> > > > >         private Long idUsuarioCreador;
>
> > > > >         private String nombreUsuarioCreador;
>
> > > > >         private Long idGrupo;
> > > > > ...
> > > > > ...
>
> > > > > Solution?
>
> > > > > Regards
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to