使用JPA 2.0在GAE Datastore中执行One-To-One关系时出现StackOverFlowError错误 [英] StackOverFlowError while doing a One-To-One relationship in GAE Datastore using JPA 2.0
问题描述
我有两个表文件夹
& VirtualSystemEntry
我试图关注这个 Dataneclous Turorial ,但它总是以 StackOverFlowException
的结果在这里,我到目前为止尝试
文件夹。 java
@Entity
public class Folder实现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();
$ / code>
VirtualSystemEntry.java
@Entity
public class VirtualSystemEntry实现了IsSerializable {
@Id
@Column(name =vseID)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName =datanucleus,key =gae.encoded-pk,value =true)
private String id;
字符串标签,图片,工具提示;
private int x,y,tray;
@OneToOne(mappedBy =vse)
Folder parent = new Folder();
}
异常跟踪
$ b $ INTERNAL_SERVER_ERROR< / pre>< / p>< h3>引起:< / h3>< pre> java.lang.StackOverflowError
at java .util.Hashtable.get(Hashtable.java:334)
在java.util.Properties.getProperty(Properties.java:932)
在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& lt; init& amp; amp; amp; lt; ;>(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder。& lt; init& gt;(Folder.java:27)
at com.cbd.shared .entities.VirtualSystemEntry。& lt; init& gt;(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder。& lt; init& gt;(Folder.java:27)
at com.cbd.shared.entities.VirtualSystemEntry。& lt; init& gt;(VirtualSystemEntry.java:28)
at com.cbd.shared .entities.Folder。& lt; init& gt;(Folder.java:27)
at com.cbd.shared.entities.VirtualSystemEntry。& lt; init& gt;(VirtualSystemEntry.java:28)
at com.cbd.shared.entities.Folder .....等等
那么我在这里做错了什么?顺便说一句,我使用 GWT
code> VirtualSystemEntry(构造函数)正在调用您的代码文件夹(构造函数)
,这会递归(并且您不提供代码那些方法),可能初始化那些类变量parent和vse...修正初始化; - )
I have two tables Folder
& VirtualSystemEntry
I tried to follow this Dataneclous Turorial but it always results with StackOverFlowException
here what I tried so far
Folder.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();
}
Piece of the Exception Trace
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
So What am I doing wrong right here ?? by the way I'm Using GWT
So your code VirtualSystemEntry(constructor)
is calling your code Folder(constructor)
, which recurses (and you don't provide the code of those methods), likely the initialisation of those class variables "parent" and "vse" ... fix the initialisation ;-)
这篇关于使用JPA 2.0在GAE Datastore中执行One-To-One关系时出现StackOverFlowError错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!