Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Toplink to EclipseLink Migration(Unit of Work Register Object Error)
Toplink to EclipseLink Migration [message #875852] Wed, 23 May 2012 12:57 Go to next message
Mike H is currently offline Mike HFriend
Messages: 3
Registered: May 2012
Junior Member
I am trying to migrate a web app from Toplink 10.1.3 (Toplink's native ORM) to EclipseLink. So far, I have replaced the toplink JAR with eclipselink, and have ran the renaming script.

Most of the db activity works, except for modifying or access existing db rows through the Unit of Work.

Every time UnitOfWork.registerObject(toplinkObject) is called, the code executes a SELECT query for that object many, many times (the query is valid) until a stack overflow occurs.

Stack trace:


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


...
(excess trace removed)
...


at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.StackOverflowError
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:566)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectOneRow(DatasourceCallQueryMechanism.java:666)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRowFromTable(ExpressionQueryMechanism.java:2656)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow(ExpressionQueryMechanism.java:2627)
at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:450)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1081)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040)
at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:418)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1128)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.internal.sessions.AbstractSession.checkAndRefreshInvalidObject(AbstractSession.java:1010)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:973)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:731)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:668)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:601)


This same problem occurs anytime I try to update a db entry from the application. I feel like I am missing something with the toplink - eclipselink migration. Any advice would be appreciated.

Let me know if you need any more information.

[Updated on: Wed, 23 May 2012 13:41]

Report message to a moderator

Re: Toplink to EclipseLink Migration [message #875904 is a reply to message #875852] Wed, 23 May 2012 14:19 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

From the stack checkAndRefreshInvalidObject, it seems your object is invalid so is being refreshed.
This was from a change in the default/new feature to refresh invalid objects when registered in a unit of work.
You can disable this refresh on your descriptor's CacheInvalidationPolicy using setShouldRefreshInvalidObjectsOnClone(false).

My guess is you have an expiry time set in your object that is very small, causing the object to still be out of date after executing the refresh query, so it gets into a loop.
You should probably also increase your cache invalidation timeout.


James : Wiki : Book : Blog : Twitter
Re: Toplink to EclipseLink Migration [message #875943 is a reply to message #875904] Wed, 23 May 2012 15:41 Go to previous messageGo to next message
Mike H is currently offline Mike HFriend
Messages: 3
Registered: May 2012
Junior Member
That worked great, thank you for the fast and helpful reply!
Re: Toplink to EclipseLink Migration [message #875953 is a reply to message #875904] Wed, 23 May 2012 15:58 Go to previous messageGo to next message
Mike H is currently offline Mike HFriend
Messages: 3
Registered: May 2012
Junior Member
Do you happen to know if there is a way to set that in EclipseLink workbench? It would be nice to have that property set each time the project java file is generated (rather than adding it in by hand for each descriptor).
Re: Toplink to EclipseLink Migration [message #878517 is a reply to message #875953] Tue, 29 May 2012 13:22 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can set it in code using an amendment method, or session customizer.

James : Wiki : Book : Blog : Twitter
Previous Topic:Duplicate column with TABLE_PER_CLASS and @OrderColumn,, bug or incorrect mapping?
Next Topic:eclipselink 2.4 mongodb with criteria api
Goto Forum:
  


Current Time: Tue Apr 16 07:57:00 GMT 2024

Powered by FUDForum. Page generated in 1.50996 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top