簡體   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