Auto increment column i JDO, GAE

Posted by Viktor on Stack Overflow See other posts from Stack Overflow or by Viktor
Published on 2011-01-01T08:17:12Z Indexed on 2011/01/02 1:54 UTC
Read the original article Hit count: 638

Hi,

I have a data class with some fields, one is a URL that I consider the PK, if I add a new item (do a new sync) and save it it should overwrite the item in the database if it's the same URL. But I also need a "normal" Long id that is incremented for every object in the database and for this one I always get null unless I tags it as a PK, how can a get this incrementation but not have the column as my PK?

@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private Long _id;
@Persistent
private String _title;
@PrimaryKey
@Persistent
private String _url;

/Viktor

© Stack Overflow or respective owner

Related posts about java

Related posts about google-app-engine