Thanks for your reply. I changed
person.setId("stsch");
to
person.setId(KeyFactory.stringToKey("stsch"));
and
@Id
private String id;
to
@Id
Key String id;
but I am still getting the same error:
java.lang.IllegalArgumentException: Cannot parse: stsch===
at
com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
192)
at
de.stsch.spring.appengine.SpringAppEngineController.get(SpringAppEngineController.java:
34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
On 8 Apr., 19:14, "Ikai L (Google)" wrote:
> Check out this set of
> Javadocs:http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
>
> Key yourKey = KeyFactory.stringToKey("yourStringHere");
>
>
>
>
>
> On Thu, Apr 8, 2010 at 3:26 AM, stsch77 wrote:
> > I have tried to follow the documentation at
>
> >http://code.google.com/intl/de-DE/appengine/docs/java/datastore/creat...
>
> > but no matter what I try, I always get an error/an exception of
> > different kinds.
>
> > Already the simplest attempt comes up with an error. That's what i
> > have:
>
> > - - - - -
>
> > public class Person {
>
> > �...@id
> > private String id;
>
> > - - - - -
>
> > ...
> > person.setId("stsch");
> > <<>>.persist(person);
> > ...
>
> > - - - - -
>
> > ==>
>
> > java.lang.IllegalArgumentException: Cannot parse: stsch===
> > at
> > com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
> > 192)
> > at
>
> > org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch(DatastoreRelationFieldManager.java:
> > 201)
> > at
>
> > org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.updateElementFk(DatastoreFKListStoreSpecialization.java:
> > 94)
> > at
>
> > org.datanucleus.store.mapped.scostore.FKListStore.updateElementFk(FKListStore.java:
> > 254)
> > ...
> > Caused by:
>
> > com.google.appengine.repackaged.com.google.common.util.Base64DecoderException:
> > invalid padding byte '=' at byte offset 5
> > at
>
> > com.google.appengine.repackaged.com.google.common.util.Base64.decode(Base64.java:
> > 529)
> > at
>
> > com.google.appengine.repackaged.com.google.common.util.Base64.decodeWebSafe(Base64.java:
> > 493)
> > at
> > com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
> > 190)
>
> > What is necessary to use a String as Primary Key?
>
> > --
> > 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.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine-
> Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--
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.