簡體   English   中英

需要有關使用jdo + datanucleus持久保存引用的(嵌入式)對象的確認

[英]Need a confirmation regarding persisting a referenced (embedded) object using jdo+datanucleus

嗨,我堅持與接口的collection(List)一個類。

我在鏈接http://www.datanucleus.org/products/accessplatform_2_1/jdo/orm/embedded.html#Collection上看到了此消息,並說“嵌入的元素不能繼承(將來可能會允許)”

那么,如何持久化這樣的對象呢?

幾個小時前,我遇到了同一問題,希望它對其他以jdo / datanucleus開頭的人有所幫助。

當前文檔所述,持久化接口集合的唯一方法是通過單向聯接表 無法直接嵌入實現該接口的對象。

@PersistenceCapable
public class SomeClass {
    @Join
    @Extension(vendorName="datanucleus", key="implementation-classes", value="ImplementingClass")
    private List<SomeInterface> myList;

    // this list would be embedded
    private List<SomeOtherClass> myOtherList;
    // ...
}

@PersistenceCapable
public interface SomeInterface {
    // ...
}

@PersistenceCapable
public class ImplementingClass implements SomeInterface {
    // ...
}

@PersistenceCapable(embeddedOnly="true")
public class SomeOtherClass {
    // ...
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM