why isn't it possible to define another key than
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
?
If i try to define a @PrimaryKey as say, an Integer I get an Server Error...
http://code.google.com/intl/de-DE/appengine/docs/java/datastore/dataclasses.html
views:
15answers:
1
+2
A:
Yes, you can use a Long
@PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id;
or a String
@PrimaryKey private String name;
See http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html
dunelmtech
2010-08-20 21:12:38
public class Commit { @PrimaryKey private String ip;}does not work
dayscott
2010-08-21 18:16:25
Did you put @PersistenceCapable(identityType = IdentityType.APPLICATION) before the class. Otherwise you'll have to tell me exactly what error you're getting
dunelmtech
2010-08-21 19:57:45
no. eclipse marks "APPLICATION" as error ( although it is in the api ... :/ )
dayscott
2010-08-22 19:18:17