[appengine-java] Re: Problem persist JDO- one to many

2010-07-11 Thread lisandrodc
Thanks Prashant, but not understand...That would be to do detach b
including all of its collections of child entities?Example of code?
The objects "Equipo" is created in my database, but when get for
Torneo b = pm.getObjectById(Torneo.class, idTorneo); the
b.getEquiposTorneo that is a collection is null. The name for example
is getting,
but not the collection...I have a singleton pattern for the Persistent
manager for all
the system.If I close it,lose the functionality.
Regards

On 11 jul, 15:04, Prashant  wrote:
> before returning b (Torneo), if you are closing PersistentManger you must
> detach b including all of its collections of child entities.
>
> --
> Prashantwww.claymus.com

-- 
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-j...@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.



[appengine-java] Re: Problem persist JDO- one to many

2010-07-12 Thread lisandrodc
Hi! Prashant/Hariharan. The problem was that I don´t have the
annotation in the collection:

@Persistent(mappedBy = "torneo", defaultFetchGroup = "true")
private List equiposTorneo;

The defaultFetchGroup = "true" is critical and in the documentation of
google it is not...
I did not have to detach collections fields...
Regards

On 12 jul, 12:43, Hariharan Anantharaman
 wrote:
> Hi Lisan,
> In the Torneo class, i am not seeing "mappedBy" attribute for @persistent
> tage for field
>
>      private List equiposTorneo;
>
> That is required to make this a owned one-many collection. Only then it
> might be possible to get collection of Equipo when retrieving Torneo  .
>
> Thanks
> Hari
>
> 2010/7/12 Prashant 
>
> > you need to create a new method in Torneo which will detach collections
> > field. Now you just need to call this function with PersistenceManager as
> > argument.
>
> > public Torneo devolverTorneo(Long idTorneo) {
>
> >              Torneo b = pm.getObjectById(Torneo.class, idTorneo);
>
> >    b.detachFields(pm);
> >    b=pm.detachCopy(b);
> >    pm.close();
>
> >              return b;
> >              //The method return the object for update
>
> > }
>
> > public class Torneo implements Serializable{
> > 
>
> > public void detachFields(PersistenceManager pm) {
>
> >  pm.detachCopyAll(equiposTorneo);
>
> > }
>
> > 
> > }
>
> > --
> > Prashant
> >www.claymus.com
>
> >  --
> > 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-j...@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.
>
>

-- 
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-j...@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.



[appengine-java] Re: Problem persist JDO- one to many

2010-07-14 Thread Luis Daniel Mesa Velasquez
It's only required for bidirectional mapping but he has a Torneo in
the Equipo, i assumed it was bidirectional by reading that... but i
could have been biased in the assumption... I found all the info here
useful... but i think the DOCS should be updated. I know all this info
ALREADY IS in the docs at
http://code.google.com/appengine/docs/java/datastore/relationships.html#Owned_One_to_One_Relationships
but since there's a little doubt it should be repeated in
http://code.google.com/appengine/docs/java/datastore/relationships.html#Owned_One_to_Many_Relationships

On Jul 13, 12:17 am, Prashant  wrote:
> Yes, it worked without explicitly detaching fields with just  
> defaultFetchGroup
> set to "true".
>
> btw,
> mappedBy property is required only for bi-directional mapping.
>
> --
> Prashantwww.claymus.com

-- 
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-j...@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.



Re: [appengine-java] Re: Problem persist JDO- one to many

2010-07-11 Thread Prashant
you need to create a new method in Torneo which will detach collections
field. Now you just need to call this function with PersistenceManager as
argument.

public Torneo devolverTorneo(Long idTorneo) {

 Torneo b = pm.getObjectById(Torneo.class, idTorneo);

   b.detachFields(pm);
   b=pm.detachCopy(b);
   pm.close();

 return b;
 //The method return the object for update

}


public class Torneo implements Serializable{


public void detachFields(PersistenceManager pm) {

 pm.detachCopyAll(equiposTorneo);

}


}

-- 
Prashant
www.claymus.com

-- 
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-j...@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.



Re: [appengine-java] Re: Problem persist JDO- one to many

2010-07-12 Thread Hariharan Anantharaman
Hi Lisan,
In the Torneo class, i am not seeing "mappedBy" attribute for @persistent
tage for field

 private List equiposTorneo;

That is required to make this a owned one-many collection. Only then it
might be possible to get collection of Equipo when retrieving Torneo  .

Thanks
Hari

2010/7/12 Prashant 

> you need to create a new method in Torneo which will detach collections
> field. Now you just need to call this function with PersistenceManager as
> argument.
>
> public Torneo devolverTorneo(Long idTorneo) {
>
>  Torneo b = pm.getObjectById(Torneo.class, idTorneo);
>
>b.detachFields(pm);
>b=pm.detachCopy(b);
>pm.close();
>
>  return b;
>  //The method return the object for update
>
> }
>
>
> public class Torneo implements Serializable{
> 
>
> public void detachFields(PersistenceManager pm) {
>
>  pm.detachCopyAll(equiposTorneo);
>
> }
>
> 
> }
>
> --
> Prashant
> www.claymus.com
>
>  --
> 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-j...@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.
>

-- 
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-j...@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.



Re: [appengine-java] Re: Problem persist JDO- one to many

2010-07-12 Thread Prashant
Yes, it worked without explicitly detaching fields with just  defaultFetchGroup
set to "true".

btw,
mappedBy property is required only for bi-directional mapping.

-- 
Prashant
www.claymus.com

-- 
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-j...@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.