App Engine JDO Persistent类从com.google.appengine.api.datastore.Key迁移到Long

时间:2013-10-17 18:24:16

标签: java mysql google-app-engine

我一直在努力获得一个在GAE上运行的应用程序,以支持其他平台,例如Jetty Server的单个实例。

持久JDO类,其主键定义如下:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "false")
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public abstract class Foo implements Bar {


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

密钥是com.google.appengine.api.datastore.Key;

如果不进行数据迁移,是否有可能以某种方式将此字段转换为Long或其他平台(如mySQL)支持的内容,而不需要使用app-engine库?

1 个答案:

答案 0 :(得分:0)

好吧看起来可以将它转换为字符串,我很高兴。

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "false")
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public abstract class EntityStore implements Entity {


    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    protected String key;