[appengine-java] Re: Datastore retrieve error

2009-11-14 Thread Gerd Saurer
Does anybody see a failure in the persistence code?

On Oct 27, 3:29 pm, Gerd Saurer gerd.sau...@gmail.com wrote:
 public SyncConfigResult create(){

  SyncConfigResult retVal = null;
  PersistenceManager pm = PMF.get().getPersistenceManager();

  try {
   SyncConfiguration syncConfig = new SyncConfiguration();
   syncConfig.setAccount1(new Account(action.getEmail1()));
   syncConfig.setAccount2(new Account(action.getEmail2()));
   syncConfig = pm.makePersistent(syncConfig);

   context.getSesion().setAttribute(SyncConfigResult.SESSION_ID,
 syncConfig.getId());

   retVal = SyncConfigActionHandler.buildSyncConfigResult
 (syncConfig);
  } finally {
   pm.close();
  }
  return retVal;

 }

 On Oct 26, 11:08 pm, Jason (Google) apija...@google.com wrote:

  Can you post the code you're using to persist the SyncConfiguration and
  Account objects?

  - Jason

  On Fri, Oct 23, 2009 at 8:09 AM,GerdSaurergerd.sau...@gmail.com wrote:

   I have a object mapped to the Datastore that looks like:

   @PersistenceCapable(identityType = IdentityType.APPLICATION)
   public class SyncConfiguration {

         �...@primarykey
         �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
          private Long id;

         �...@persistent
          private Account account1;

         �...@persistent
          private Account account2;

   ..
   }

   @PersistenceCapable(identityType = IdentityType.APPLICATION)
   public class Account {

         �...@primarykey
         �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
          private Key key;

         �...@persistent
          private String email;

   .
   }

   if i am now loading the object back from the store with

   final SyncConfiguration syncConfig = pm.getObjectById
   (SyncConfiguration.class, action.getSyncConfigId());

   the fields account1 and account2 have the same instance.

   Do i have to configure something in a different way or is it a bug?

--

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




[appengine-java] Re: Datastore retrieve error

2009-10-27 Thread Gerd Saurer

public SyncConfigResult create(){

 SyncConfigResult retVal = null;
 PersistenceManager pm = PMF.get().getPersistenceManager();

 try {
  SyncConfiguration syncConfig = new SyncConfiguration();
  syncConfig.setAccount1(new Account(action.getEmail1()));
  syncConfig.setAccount2(new Account(action.getEmail2()));
  syncConfig = pm.makePersistent(syncConfig);

  context.getSesion().setAttribute(SyncConfigResult.SESSION_ID,
syncConfig.getId());

  retVal = SyncConfigActionHandler.buildSyncConfigResult
(syncConfig);
 } finally {
  pm.close();
 }
 return retVal;
}


On Oct 26, 11:08 pm, Jason (Google) apija...@google.com wrote:
 Can you post the code you're using to persist the SyncConfiguration and
 Account objects?

 - Jason

 On Fri, Oct 23, 2009 at 8:09 AM, Gerd Saurer gerd.sau...@gmail.com wrote:

  I have a object mapped to the Datastore that looks like:

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class SyncConfiguration {

        �...@primarykey
        �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
         private Long id;

        �...@persistent
         private Account account1;

        �...@persistent
         private Account account2;

  ..
  }

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class Account {

        �...@primarykey
        �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
         private Key key;

        �...@persistent
         private String email;

  .
  }

  if i am now loading the object back from the store with

  final SyncConfiguration syncConfig = pm.getObjectById
  (SyncConfiguration.class, action.getSyncConfigId());

  the fields account1 and account2 have the same instance.

  Do i have to configure something in a different way or is it a bug?
--~--~-~--~~~---~--~~
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] Datastore retrieve error

2009-10-23 Thread Gerd Saurer

I have a object mapped to the Datastore that looks like:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class SyncConfiguration {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;

@Persistent
private Account account1;

@Persistent
private Account account2;

..
}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

@Persistent
private String email;

.
}

if i am now loading the object back from the store with

final SyncConfiguration syncConfig = pm.getObjectById
(SyncConfiguration.class, action.getSyncConfigId());

the fields account1 and account2 have the same instance.

Do i have to configure something in a different way or is it a bug?

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