Skip to main content



      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 08:57 Go to next message
Eclipse UserFriend
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 09:41] by Moderator

Re: Toplink to EclipseLink Migration [message #875904 is a reply to message #875852] Wed, 23 May 2012 10:19 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Toplink to EclipseLink Migration [message #875943 is a reply to message #875904] Wed, 23 May 2012 11:41 Go to previous messageGo to next message
Eclipse UserFriend
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 11:58 Go to previous messageGo to next message
Eclipse UserFriend
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 09:22 Go to previous message
Eclipse UserFriend
You can set it in code using an amendment method, or session customizer.
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: Mon Jul 07 21:35:14 EDT 2025

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

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

Back to the top