No, no errors on the console

On Mar 21, 9:47 pm, John Howe <[email protected]> wrote:
> Does the server console log say anything?
>
>
>
> On Sun, Mar 21, 2010 at 8:13 PM, alosii <[email protected]> wrote:
> > So I've been struggling with a very simple thing. I have a User that
> > contains a list of items. I want to remove an item from this list. I
> > do this by doing this:
>
> > 1.- Get the user from the db
> > 2.- Remove the item from the list
> > 3.- Call an update on the user
>
> > On code:
>
> > public void removePlaylist(String userID, String playlistName) {
> >                XYZUserContainer userCont = new XYZUserContainer();
> >                XYZUser user = userCont.getUserByEmail(userID);
> >                user.removePlaylist(playlistName);
> >                userCont.updateUser(user);
> > }
>
> > The problem: the change is not saved on the DB. The user's list is
> > correctly modified but is not persisted.
>
> > "How do you update it?"  you must me asking:
> > public XYZUser updateUser(XYZUser user) {
> >                PersistenceManager pm = PMF.get().getPersistenceManager();
> >                Transaction tx = pm.currentTransaction();
> >                try {
> >                        tx.begin();
> >                        XYZUser updatedUser = pm.makePersistent(user);
> >                        tx.commit();
> >                        return updatedUser;
> >                } catch (RuntimeException ex) {
> >                        ex.printStackTrace();
> >                        throw ex;
> >                } finally {
> >                        if (tx.isActive()) {
> >                                tx.rollback();
> >                        }
> >                        pm.close();
> >                }
> >        }
>
> > "How do you get the user?"
> > public XYZUser getUserByEmail(String email) {
> >                PersistenceManager pm = PMF.get().getPersistenceManager();
> >                pm.setDetachAllOnCommit(true);
> >                try {
> >                        XYZUser user = pm.getObjectById(XYZUser.class,
> > email);
> >                        pm.close();
> >                        return user;
> >                } catch (javax.jdo.JDOObjectNotFoundException e) {
> >                        pm.close();
> >                        return null;
> >                }
> >        }
>
> > The annotations:
>
> > =========================================================================== 
> > =======
> > XYZUser:
> > public class XYZUser {
> >        ....
>
> >       �...@persistent(defaultFetchGroup="true")
> >       �...@expose
> >        private List<XYZMusicList> djLists = new ArrayList<XYZMusicList>();
>
> > =========================================================================== 
> > =======
>
> > XYZMusicList:
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable="true")
> > public class XYZMusicList {
> >       �...@primarykey
> >       �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >        private Key id;
>
> >       �...@persistent
> >       �...@expose
> >        private String nameOfList;
>
> >       �...@persistent(defaultFetchGroup="true")
> >       �...@expose
> >        private List<Long> musicList = new ArrayList<Long>();
>
> >       �...@override
> >        public boolean equals(Object obj) {
> >                try{
> >                        XYZMusicList listaAntigua = (XYZMusicList) obj;
>
> >  if(this.nameOfList.compareToIgnoreCase(listaAntigua.nameOfList)==0)
> >                                return true;
> >                }catch(ClassCastException e){
> >                        return false;
> >                }
> >                return false;
> >        }
>
> > =========================================================================== 
> > =======
>
> > I've read the following page (http://www.datanucleus.org/products/
> > accessplatform_1_1/jdo/orm/one_to_many_list.html<http://www.datanucleus.org/products/%0Aaccessplatform_1_1/jdo/orm/one...>)
> > but there are no
> > examples with the annotations that google app engine uses.
>
> > Any ideas on whats wrong?
>
> > --
> > 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
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine-java%2B 
> > [email protected]>
> > .
> > 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to