English 中文(简体)
Mongo ReflectionDBObject,map ALL嵌入阵列元素到一间;
原标题:Mongo ReflectionDBObject, map ALL embedded array s elements to a class;

我使用Mongo语为本地的Java司机(第3个政党图书馆/ORM)。 我有:

public class Release extends ReflectionDBObject {

    //other fields omitted    

    private List<ReleaseDetailsByTerritory> releaseDetailsByTerritory = new ArrayList<ReleaseDetailsByTerritory>();

}

public class ReleaseDetailsByTerritory extends ReflectionDBObject { //...}

如果我想找回两个“ReleaseDetailsByTerritory”条目的“Release”条目,并在包含两个释放清单的释放类别中实现自动化。

releaseColl.setObjectClass(Release.class);
releaseColl.setInternalClass("ReleaseDetailsByTerritory.0", ReleaseDetailsByTerritory.class);
releaseColl.setInternalClass("ReleaseDetailsByTerritory.1", ReleaseDetailsByTerritory.class);
Release r = (Release) releaseColl.findOne();

i.e. 我需要具体地将嵌入式阵列的每个潜在组成部分绘制到相应的类别。

是否有办法告诉Mongo的司机,我想要把一根嵌入的阵列中的任何部分划入某个阶层? 类似:

collection.setInternalClass("ReleaseDetailsByTerritory.*", ReleaseDetailsByTerritory.class);

?

感谢。 请不要说“MondoDb模块或Morphia”。 我想知道,这能否在蒙戈纳本土的贾瓦司机面前实现。

最佳回答

看看来源法,我认为这是不可能的。 也没有明显的途径来为你们的需要创造方便的功能。 由于大量使用记忆,因此大型阵列将很难成为一种选择。

你可能希望考虑执行你自己需要的“文件”类别,而不必去做诸如Morphia等全面的制图解决办法(实际上,它比春季要好,至少要如此)。

你还可以考虑在吉拉开一个联合执行认证问题。 mongodb.org 并请求提供这一特征。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签