StackOverFlow [message #755309] |
Mon, 07 November 2011 22:33  |
Eclipse User |
|
|
|
Hi for all,
I have started project with EclipseLink... thats great... but, I got stackoverflow with this scenario:
Entities : ClassList, lvlupgain and skilltrees.
ClassList have a column id and it can be referenced for lvlupgain and skilltrees.
ClassList -> lvlupgain (OneToOne)
ClassList -> skilltrees (OneToMany)
RecordCount:
ClassList = 89
lvlupgain = 89
skill_trees = 13722
public void loadData() {
EntityManagerFactory emf;
emf = Persistence.createEntityManagerFactory("TestRelationshipPU");
ClassListJpaController jpa = new ClassListJpaController(emf);
List<ClassList> listData = jpa.findClassListEntities();
for (ClassList classList : listData) {
System.out.println("classList" + classList.getClassName());
}
}
Error:
[EL Info]: 2011-11-08 01:08:30.682--ServerSession(9202071)--EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913
[EL Info]: 2011-11-08 01:08:31.644--ServerSession(9202071)--file:/D:/Projects/TestRelationship/src/_TestRelationshipPU login successful
Exception in thread "main" java.lang.StackOverflowError
at org.eclipse.persistence.internal.sessions.AbstractSession.getDescriptor(AbstractSession.java:2067)
at org.eclipse.persistence.internal.sessions.AbstractSession.getDescriptor(AbstractSession.java:2136)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3816)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.buildUnitofWorkCloneForPartObject(ObjectReferenceMapping.java:96)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.buildCloneForPartObject(ObjectReferenceMapping.java:70)
What cause this error? Thanks so much for your help and NICE Project!!!
Caio
|
|
|
|
|
|
Re: StackOverFlow [message #755845 is a reply to message #755771] |
Wed, 09 November 2011 14:41  |
Eclipse User |
|
|
|
Hello,
I'm not sure what you mean by adding a link with 89 records. Does that mean that there are only 89 instances of the referenced entity, or that 89 instances exist on the object tree being brought in? Depending on your object tree, 89 instances could add multiple layers of recursion when building it. As mentioned, EclipseLink does use recursion when building the object model. So the way around the stack overflow is to reduce the size of your object graph through the use of indirection or removing relationships, or by increasing the size the stack can grow to in your JVM.
Indirection/lazy relationships are described here:http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#What_You_May_Need_to_Know_About_EclipseLink_JPA_Lazy_Loading
The JVM stack size for each thread is generally set using -Xss but you will want to look into appropriate values for your application, as more JVM tuning might be required as well.
Best Regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.04479 seconds