简体   繁体   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

I've been working to get an app that runs on GAE to support other platforms like a single instance of a Jetty Server. 我一直在努力获得在GAE上运行的应用程序,以支持其他平台,例如Jetty Server的单个实例。

A Persistent JDO class with a primary key defined like this: 具有主键定义的持久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;

The key is a com.google.appengine.api.datastore.Key; 密钥是com.google.appengine.api.datastore.Key;

Short of doing a data migration, is it possible to somehow convert this field to a Long or something that's supported in other platforms like mySQL and not needing to use an app-engine library? 如果不进行数据迁移,是否有可能以某种方式将此字段转换为Long或其他平台(例如mySQL)支持的内容,而无需使用应用程序引擎库?

ok looks like it's possible to just convert it to a string and i'm good to go. 好的,看起来有可能将其转换为字符串,我很高兴。

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

相关问题 如何在Google App Engine _ah / api / explorer中创建com.google.appengine.api.datastore.Key对象? - How to create the com.google.appengine.api.datastore.Key object in the Google App Engine _ah/api/explorer? Google App Engine:java.lang.ClassCastException:com.google.appengine.api.datastore.Key 无法转换为 java.lang.Integer - Google App Engine: java.lang.ClassCastException: com.google.appengine.api.datastore.Key cannot be cast to java.lang.Integer 从字符串生成密钥(com.google.appengine.api.datastore.Key) - Generating a Key (com.google.appengine.api.datastore.Key) from string Google Appengine-ID为“ com.google.appengine.api.datastore.Key:Product(“ Potatoe”)”的对象由其他对象管理器管理 - Google Appengine - Object with id “com.google.appengine.api.datastore.Key:Product(”Potatoe“)” is managed by a different Object Manager Google App Engine-java.lang.NoClassDefFoundError:com.google.appengine.api.datastore.DatastoreServiceFactory - Google App Engine - java.lang.NoClassDefFoundError: com.google.appengine.api.datastore.DatastoreServiceFactory Google App Engine:java.lang.NoClassDefFoundError:com / google / appengine / api / datastore / Query $ Filter - Google App Engine: java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/Query$Filter 如何将Google App Engine数据存储区中的数据写入com.google.appengine.api.datastore.Text - How do I write data in my Google App Engine Datastore to com.google.appengine.api.datastore.Text Google App引擎:JDO +数据存储的性能不佳 - Google app engine: Poor Performance with JDO + Datastore JDO(Google App Engine)中的永久列表 - Persistent list in JDO (Google App Engine) 示例应用中的com.google.appengine.api.datastore.DatastoreNeedIndexException错误 - com.google.appengine.api.datastore.DatastoreNeedIndexException error in Sample App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM