Google App Engine 是否支持带有“Object”的 JDO 数据对象?领域?

发布于 2024-08-13 09:11:46 字数 2566 浏览 6 评论 0原文

我的 JDO 类之一中有一个“Object”字段,如下所示:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
class Foo {
   ...
   @Persistent
   @Value(types={java.lang.Boolean.class, java.lang.String.class})
   Object bar;
   ...
}

当我尝试访问该字段时,出现以下异常:

Field "Foo.bar" is declared as a reference
type (interface/Object) but no implementation classes of "java.lang.Object" have been found!
org.datanucleus.exceptions.NucleusUserException: Field "Foo.bar" is declared as a reference type (interface/Object) but no implementation classes of "java.lan
g.Object" have been found!
        at org.datanucleus.metadata.MetaDataUtils.getImplementationNamesForReferenceField(MetaDataUtils.java:531)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.createPerImplementationColumnsForReferenceField(Re
ferenceMapping.java:279)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.prepareDatastoreMapping(ReferenceMapping.java:205)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.initialize(ReferenceMapping.java:114)
        at org.datanucleus.store.mapped.mapping.MappingFactory.createMapping(MappingFactory.java:97)
        at org.datanucleus.store.mapped.mapping.AbstractMappingManager.getMapping(AbstractMappingManager.java:248)
        at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK(DatastoreTable.java:301)
        at org.datanucleus.store.appengine.DatastoreTable.buildMapping(DatastoreTable.java:276)
        at org.datanucleus.store.appengine.DatastoreManager.newStoreData(DatastoreManager.java:329)
        at org.datanucleus.store.AbstractStoreManager.addClasses(AbstractStoreManager.java:788)
        at org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:759)
        at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass(MappedStoreManager.java:358)
        at org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass(DatastoreManager.java:555)
        at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:200)
        at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:84)
        at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
        at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
        at org.datanucleus.store.query.Query.execute(Query.java:1344)
        at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)

有谁知道 Google App Engine 是否支持“@Value”注释和/或如何解决这个问题吗?

谢谢!

I have an "Object" field in one of my JDO classes, like this:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
class Foo {
   ...
   @Persistent
   @Value(types={java.lang.Boolean.class, java.lang.String.class})
   Object bar;
   ...
}

When I tried to access this field, I got the following exception:

Field "Foo.bar" is declared as a reference
type (interface/Object) but no implementation classes of "java.lang.Object" have been found!
org.datanucleus.exceptions.NucleusUserException: Field "Foo.bar" is declared as a reference type (interface/Object) but no implementation classes of "java.lan
g.Object" have been found!
        at org.datanucleus.metadata.MetaDataUtils.getImplementationNamesForReferenceField(MetaDataUtils.java:531)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.createPerImplementationColumnsForReferenceField(Re
ferenceMapping.java:279)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.prepareDatastoreMapping(ReferenceMapping.java:205)
        at org.datanucleus.store.mapped.mapping.ReferenceMapping.initialize(ReferenceMapping.java:114)
        at org.datanucleus.store.mapped.mapping.MappingFactory.createMapping(MappingFactory.java:97)
        at org.datanucleus.store.mapped.mapping.AbstractMappingManager.getMapping(AbstractMappingManager.java:248)
        at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK(DatastoreTable.java:301)
        at org.datanucleus.store.appengine.DatastoreTable.buildMapping(DatastoreTable.java:276)
        at org.datanucleus.store.appengine.DatastoreManager.newStoreData(DatastoreManager.java:329)
        at org.datanucleus.store.AbstractStoreManager.addClasses(AbstractStoreManager.java:788)
        at org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:759)
        at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass(MappedStoreManager.java:358)
        at org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass(DatastoreManager.java:555)
        at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:200)
        at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:84)
        at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
        at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
        at org.datanucleus.store.query.Query.execute(Query.java:1344)
        at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)

Does anyone know if Google App Engine supports the "@Value" annotation and/or how to get around this problem?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

素染倾城色 2024-08-20 09:11:46

谢谢!我不应该使用@Value,而是应该这样做:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
class Foo {
   ...
   @Persistent(types={java.lang.Boolean.class, java.lang.String.class})
   Object bar;
   ...
}

Thanks! Instead of using @Value, I should do this instead:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
class Foo {
   ...
   @Persistent(types={java.lang.Boolean.class, java.lang.String.class})
   Object bar;
   ...
}
清风不识月 2024-08-20 09:11:46

根据他们的页面,Google App-Engine 使用 DataNucleus 来支持 JDO。从 DataNucleus 的网站来看,似乎支持 @Value 注释,但在“type”属性上,它显示“虽然该属性允许多个值,但 DataNucleus 目前仅支持第一个类型值

” datanucleus.org/products/accessplatform_1_1/jdo/annotations.html#Value" rel="nofollow noreferrer">http://www.datanucleus.org/products/accessplatform_1_1/jdo/annotations.html#Value

附录, @Value 似乎仅用于地图。

According to their pages, Google App-Engine uses DataNucleus for its JDO support. From DataNucleus's site, it appears that the @Value annotation is supported, but on the 'type' attribute it says "While the attribute allows multiple values DataNucleus currently only supports the first type value"

http://www.datanucleus.org/products/accessplatform_1_1/jdo/annotations.html#Value

Addendum, it also seems that @Value is only used for maps.

静赏你的温柔 2024-08-20 09:11:46

如果使用对象类型的字段,则 DN 文档中的页面是
http://www.datanucleus.org/products/accessplatform_1_1/jdo/ orm/objects.html
它明确支持 RDBMS、XML、LDAP、ODBMS 等数据存储。我不知道Google的BigTable插件是否支持它。也许如果您发布该异常的堆栈跟踪,您可以向人们展示它来自哪里...

--Andy (DataNucleus)

If using a field of type Object then the page in the DN docs is
http://www.datanucleus.org/products/accessplatform_1_1/jdo/orm/objects.html
which is clearly supported for RDBMS, XML, LDAP, ODBMS etc datastores. Whether Google's BigTable plugin supports it I've no idea. Perhaps if you post the stack trace of that exception you can show people where it comes from ...

--Andy (DataNucleus)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文