0
在GAE的數據存儲中的一個一對一的關係我有兩個表Folder
& VirtualSystemEntry
我想按照這個Dataneclous Turorial但它總是與StackOverFlowException
這裏是我的嘗試到目前爲止的StackOverflowError同時做好使用JPA 2.0
文件夾結果。 java的
@Entity
public class Folder implements IsSerializable{
@Id
@Column(name = "fvseID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
private String fvseID;
@OneToOne
@JoinColumn(name="vseID")
private VirtualSystemEntry vse=new VirtualSystemEntry();
}
VirtualSystemEntry.java
@Entity
public class VirtualSystemEntry implements IsSerializable {
@Id
@Column(name = "vseID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
private String id;
String label, image, tooltip;
private int x, y, tray;
@OneToOne(mappedBy="vse")
Folder parent = new Folder();
}
一塊異常跟蹤
INTERNAL_SERVER_ERROR</pre></p><h3>Caused by:</h3><pre>java.lang.StackOverflowError
at java.util.Hashtable.get(Hashtable.java:334)
at java.util.Properties.getProperty(Properties.java:932)
at java.lang.System.getProperty(System.java:653)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:63)
at com.cbd.shared.entities.VirtualSystemEntry.<init>(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder.<init>(Folder.java:27)
at com.cbd.shared.entities.VirtualSystemEntry.<init>(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder.<init>(Folder.java:27)
at com.cbd.shared.entities.VirtualSystemEntry.<init>(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder.<init>(Folder.java:27)
at com.cbd.shared.entities.VirtualSystemEntry.<init>(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder..... and so on
那麼我在這裏做錯了什麼?順便說一下我使用GWT
非常感謝您的回覆我確信您會先回答這個問題:)。 所以,我認爲你的意思是從兩個參考中刪除指定的對象:例如:'文件夾父項;' 對不對?因爲我實際上依賴於默認的構造函數,這是由於帶有參數的構造函數的'JPA'問題 – YouYou