繁体   English   中英

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

[英]App Engine JDO Persistent class migrate from com.google.appengine.api.datastore.Key to Long

我一直在努力获得在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)支持的内容,而无需使用应用程序引擎库?

好的,看起来有可能将其转换为字符串,我很高兴。

@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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM