[appengine-java] Re: Collection object not being updated

2011-03-18 Thread Cosmin Stefan
I still haven't figured this one out. Am I doing something wrong or
there's a small bug in the JDO GAE implementation?

Btw, I saw all the documentation has been changed to LowLevelAPI. Will
JDO loose support sometimes soon?

Thanks,
Cosmin

On Mar 6, 5:07 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
wrote:
 Hey,

 I cannot use a transaction as I need to change multiple entries (as u
 see, for each BigClass participant i have to remove an object from the
 collection).

 Regarding the pm.makePersistent() call, I have tried with it before
 and it didn't do anything different. Plus that on the GAE
 documentation page they say it's not needed, as the pm tracks all the
 changes.

 I have discovered another thing related to this problem. As I've shown
 you, in the same persistence call I try to do these (remove smth from
 the collection) changes and I also modify other objects. The weird
 fact is that the last changes I make are persisted, while the others
 aren't. Why is that?

 Regarding JPA I'll look into it, but it's kind of difficult as I
 already have a huge part of my code written with JDO.

 Anyway, looking forward to hearing new suggestions!

 Thanks,
 Cosmin

 On Mar 1, 6:59 pm, Ian Marshall ianmarshall...@gmail.com wrote:

  Hi Cosmin,

  I do not see any calls to

    pm.makePersistent(...);

  I use this to persist newly-created persistent instances.

  I know that you do not use transactions, but I do. Within an active
  transaction, one can update persistent instances and even persist or
  delete entity group child instances without calling

    pm.makePersistent(...);

  Have you looked at the GAE persistence blog of Max Ross of Google?
  There are some excellent working examples there...

  Ian

  On Feb 28, 6:55 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
  wrote:

   So no ideea anyone?

   On Feb 25, 11:42 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
   wrote:

Hey,

I have an issue while trying to update one object in a collection,
using JDO.

Here are the facts:
   o i have a class (let's call it BigClass), that has an embedded
class(SmallClass) containing an ArrayList.
   o I DONT use/need a transaction
   o I query the database to get a List of BigClass items that should
be modified. I iterate through each of them and I...
   o I remove an element from the list in the SmallClass embedded in
the current BigClass, the changes are not ALWAYS persisted
   o if I print (log) the object after the change, it looks modified,
but if i check the DataViewer, the object was not updated
   o i even tried using JDOHelper.makeDirty on the BigClass, with the
fieldName SmallClass, and it still doesn't work.

Some relevant code:

                                Query q = 
pm.newQuery(BigClass.class,id==:ids);
                                ListBigClass 
participatingUsers=(ListBigClass)
q.execute(participantIDs);

                                //Update the participants
                                ListIteratorBigClass 
it=participatingUsers.listIterator();
                                BigClass participant;
                                boolean modified;
                                while(it.hasNext())
                                {
                                        participant=it.next();
                                        participant.list.remove(smth);

JDOHelper.makeDirty(participant,collection);
                               }
                               
                               modify other objects
                               
                               pm.close()

Another thing is that some of the changes I make after this part are
persisted...

So, if you have any suggestions, shoot pls!

Cosmin

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



[appengine-java] Re: Collection object not being updated

2011-03-06 Thread Cosmin Stefan
Hey,

I cannot use a transaction as I need to change multiple entries (as u
see, for each BigClass participant i have to remove an object from the
collection).

Regarding the pm.makePersistent() call, I have tried with it before
and it didn't do anything different. Plus that on the GAE
documentation page they say it's not needed, as the pm tracks all the
changes.

I have discovered another thing related to this problem. As I've shown
you, in the same persistence call I try to do these (remove smth from
the collection) changes and I also modify other objects. The weird
fact is that the last changes I make are persisted, while the others
aren't. Why is that?

Regarding JPA I'll look into it, but it's kind of difficult as I
already have a huge part of my code written with JDO.

Anyway, looking forward to hearing new suggestions!

Thanks,
Cosmin

On Mar 1, 6:59 pm, Ian Marshall ianmarshall...@gmail.com wrote:
 Hi Cosmin,

 I do not see any calls to

   pm.makePersistent(...);

 I use this to persist newly-created persistent instances.

 I know that you do not use transactions, but I do. Within an active
 transaction, one can update persistent instances and even persist or
 delete entity group child instances without calling

   pm.makePersistent(...);

 Have you looked at the GAE persistence blog of Max Ross of Google?
 There are some excellent working examples there...

 Ian

 On Feb 28, 6:55 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
 wrote:

  So no ideea anyone?

  On Feb 25, 11:42 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
  wrote:

   Hey,

   I have an issue while trying to update one object in a collection,
   using JDO.

   Here are the facts:
      o i have a class (let's call it BigClass), that has an embedded
   class(SmallClass) containing an ArrayList.
      o I DONT use/need a transaction
      o I query the database to get a List of BigClass items that should
   be modified. I iterate through each of them and I...
      o I remove an element from the list in the SmallClass embedded in
   the current BigClass, the changes are not ALWAYS persisted
      o if I print (log) the object after the change, it looks modified,
   but if i check the DataViewer, the object was not updated
      o i even tried using JDOHelper.makeDirty on the BigClass, with the
   fieldName SmallClass, and it still doesn't work.

   Some relevant code:

                                   Query q = 
   pm.newQuery(BigClass.class,id==:ids);
                                   ListBigClass 
   participatingUsers=(ListBigClass)
   q.execute(participantIDs);

                                   //Update the participants
                                   ListIteratorBigClass 
   it=participatingUsers.listIterator();
                                   BigClass participant;
                                   boolean modified;
                                   while(it.hasNext())
                                   {
                                           participant=it.next();
                                           participant.list.remove(smth);

   JDOHelper.makeDirty(participant,collection);
                                  }
                                  
                                  modify other objects
                                  
                                  pm.close()

   Another thing is that some of the changes I make after this part are
   persisted...

   So, if you have any suggestions, shoot pls!

   Cosmin

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



[appengine-java] Re: Collection object not being updated

2011-03-04 Thread lisandrodc
Hi Cosmin!
I have decided to use JPA due to the fact that with JDO I met several
bugs associated
with GAE and JPA I had fewer problems, beyond the restrictions that
there imposes GAE of the correct
use of the oriented object programming . Because of it I recommend to
you to use for GAE, JPA...
Regards

On Mar 1, 1:59 pm, Ian Marshall ianmarshall...@gmail.com wrote:
 Hi Cosmin,

 I do not see any calls to

   pm.makePersistent(...);

 I use this to persist newly-created persistent instances.

 I know that you do not use transactions, but I do. Within an active
 transaction, one can update persistent instances and even persist or
 delete entity group child instances without calling

   pm.makePersistent(...);

 Have you looked at the GAE persistence blog of Max Ross of Google?
 There are some excellent working examples there...

 Ian

 On Feb 28, 6:55 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
 wrote:



  So no ideea anyone?

  On Feb 25, 11:42 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
  wrote:

   Hey,

   I have an issue while trying to update one object in a collection,
   using JDO.

   Here are the facts:
      o i have a class (let's call it BigClass), that has an embedded
   class(SmallClass) containing an ArrayList.
      o I DONT use/need a transaction
      o I query the database to get a List of BigClass items that should
   be modified. I iterate through each of them and I...
      o I remove an element from the list in the SmallClass embedded in
   the current BigClass, the changes are not ALWAYS persisted
      o if I print (log) the object after the change, it looks modified,
   but if i check the DataViewer, the object was not updated
      o i even tried using JDOHelper.makeDirty on the BigClass, with the
   fieldName SmallClass, and it still doesn't work.

   Some relevant code:

                                   Query q = 
   pm.newQuery(BigClass.class,id==:ids);
                                   ListBigClass 
   participatingUsers=(ListBigClass)
   q.execute(participantIDs);

                                   //Update the participants
                                   ListIteratorBigClass 
   it=participatingUsers.listIterator();
                                   BigClass participant;
                                   boolean modified;
                                   while(it.hasNext())
                                   {
                                           participant=it.next();
                                           participant.list.remove(smth);

   JDOHelper.makeDirty(participant,collection);
                                  }
                                  
                                  modify other objects
                                  
                                  pm.close()

   Another thing is that some of the changes I make after this part are
   persisted...

   So, if you have any suggestions, shoot pls!

   Cosmin

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



[appengine-java] Re: Collection object not being updated

2011-03-01 Thread Ian Marshall
Hi Cosmin,

I do not see any calls to

  pm.makePersistent(...);

I use this to persist newly-created persistent instances.

I know that you do not use transactions, but I do. Within an active
transaction, one can update persistent instances and even persist or
delete entity group child instances without calling

  pm.makePersistent(...);

Have you looked at the GAE persistence blog of Max Ross or Google?
There are some excellent working examples there...

Ian


On Feb 28, 6:55 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
wrote:
 So no ideea anyone?

 On Feb 25, 11:42 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
 wrote:

  Hey,

  I have an issue while trying to update one object in a collection,
  using JDO.

  Here are the facts:
     o i have a class (let's call it BigClass), that has an embedded
  class(SmallClass) containing an ArrayList.
     o I DONT use/need a transaction
     o I query the database to get a List of BigClass items that should
  be modified. I iterate through each of them and I...
     o I remove an element from the list in the SmallClass embedded in
  the current BigClass, the changes are not ALWAYS persisted
     o if I print (log) the object after the change, it looks modified,
  but if i check the DataViewer, the object was not updated
     o i even tried using JDOHelper.makeDirty on the BigClass, with the
  fieldName SmallClass, and it still doesn't work.

  Some relevant code:

                                  Query q = 
  pm.newQuery(BigClass.class,id==:ids);
                                  ListBigClass 
  participatingUsers=(ListBigClass)
  q.execute(participantIDs);

                                  //Update the participants
                                  ListIteratorBigClass 
  it=participatingUsers.listIterator();
                                  BigClass participant;
                                  boolean modified;
                                  while(it.hasNext())
                                  {
                                          participant=it.next();
                                          participant.list.remove(smth);

  JDOHelper.makeDirty(participant,collection);
                                 }
                                 
                                 modify other objects
                                 
                                 pm.close()

  Another thing is that some of the changes I make after this part are
  persisted...

  So, if you have any suggestions, shoot pls!

  Cosmin



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



[appengine-java] Re: Collection object not being updated

2011-02-28 Thread Cosmin Stefan
So no ideea anyone?

On Feb 25, 11:42 pm, Cosmin Stefan cosmin.stefandob...@gmail.com
wrote:
 Hey,

 I have an issue while trying to update one object in a collection,
 using JDO.

 Here are the facts:
    o i have a class (let's call it BigClass), that has an embedded
 class(SmallClass) containing an ArrayList.
    o I DONT use/need a transaction
    o I query the database to get a List of BigClass items that should
 be modified. I iterate through each of them and I...
    o I remove an element from the list in the SmallClass embedded in
 the current BigClass, the changes are not ALWAYS persisted
    o if I print (log) the object after the change, it looks modified,
 but if i check the DataViewer, the object was not updated
    o i even tried using JDOHelper.makeDirty on the BigClass, with the
 fieldName SmallClass, and it still doesn't work.

 Some relevant code:

                                 Query q = 
 pm.newQuery(BigClass.class,id==:ids);
                                 ListBigClass 
 participatingUsers=(ListBigClass)
 q.execute(participantIDs);

                                 //Update the participants
                                 ListIteratorBigClass 
 it=participatingUsers.listIterator();
                                 BigClass participant;
                                 boolean modified;
                                 while(it.hasNext())
                                 {
                                         participant=it.next();
                                         participant.list.remove(smth);

 JDOHelper.makeDirty(participant,collection);
                                }
                                
                                modify other objects
                                
                                pm.close()

 Another thing is that some of the changes I make after this part are
 persisted...

 So, if you have any suggestions, shoot pls!

 Cosmin

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