Cannot merge versioned instance after flush, getting OptimisticLockExceptio

Using EclipseLink 2.0.2 I cannot merge versioned object after flush, getting OptimisticLockException.
I get this:
MergeManager.mergeChangesOfCloneIntoWorkingCopy(Object) line: 490     
MergeManager.mergeChanges(Object, ObjectChangeSet) line: 267     
RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Object, MergeManager) line: 3523     
RepeatableWriteUnitOfWork.mergeCloneWithReferences(Object, MergeManager) line: 301     
RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Object, int, boolean) line: 3483     
RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Object, int) line: 3457     
RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Object) line: 3438     
Any known workaround?
After the flush the versioned object version has increase of one, then the merge code compare with the increased version; however, the original version is still available in ObjectChangeSet.initialWriteLockValue.
Since flush is an automatic thing depending of states that change often, even for similiar use case, it is expected to be transparent, so should have no effect on merge. In other words, functionality should be unchanged by the trigger of flush or by the use of other technique to get the right data like by using conform in memory.

My understanding is that the behavior is incompatible with the old functionality of supporting multiple merges, which by definition would always give OptimisticLockException.
Extract from: http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/b13698/oracle/toplink/sessions/UnitOfWork.html
setShouldNewObjectsBeCached
public void setShouldNewObjectsBeCached(boolean shouldNewObjectsBeCached)ADVANCED: By default new objects are not cached until the exist on the database. Occasionally if mergeClone is used on new objects and is required to allow multiple merges on the same new object, then if the new objects are not cached, each mergeClone will be interpretted as a different new object. By setting new objects to be cached mergeClone can be performed multiple times before commit. New objects cannot be cached unless they have a valid assigned primary key before being registered. New object with non-null invalid primary keys such as 0 or '' can cause problems and should not be used with this option.
I believe the current behavior come from Hibernate that have imposed many of their sematic/anti-patterns to JPA. Since Hibernate team have pushed a lot open session pattern, the current behavior is more likeable for them.
Ideally both behaviors should be supported, and supporting multiple merges and flush followed by merge should be the default.

Similar Messages

  • Cannot start OC4J instance after specifying default java.security.manager

    Hi All,
    I am using OracleiAS 10.1.3.4 and trying to make use of the new User and Role APIs introduced in 10.1.3.1.
    While trying to get an object of IdentityStore using the following code, I got this error -
    java.security.PrivilegedActionException: oracle.security.idm.ConfigurationException: java.security.AccessControlException: access denied (oracle.security.jazn.JAZNPermission getOC4JIntegrationData)
    oidFactory = (IdentityStoreFactory) AccessController.doPrivileged(
    new PrivilegedExceptionAction()
    public Object run() throws IMException
    IdentityStoreFactoryBuilder builder =
    new IdentityStoreFactoryBuilder();
    return builder.getIdentityStoreFactory();
    I then tried specifying the default security manager in start JAVA options for my oc4j instance - Djava.security.manager. I also verified that my java policy file is present under $ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy. But the issue is - once I put this default secirity manager in startup options in opmn.xml, the oc4j instance does not get started, it gives following error -
    08/12/30 02:58:22 Start process
    Dec 30, 2008 2:58:24 AM com.evermind.server.XMLDataSourcesConfig parseRootNode
    INFO: Legacy datasource detected...attempting to convert to new syntax.
    08/12/30 02:58:29 WARNING: Application.setConfig Application: default is in failed state as initialization failed.
    java.lang.ExceptionInInitializerError
    08/12/30 02:58:29 Error initializing server: Application: default is in failed state as initialization failed
    08/12/30 02:58:32 Fatal error: server exiting
    Any idea ? Any pointers please ?
    Thanks,
    Ankit

    Ankit,
    Check your syntax for the datasource. If you migrated from file-based to OID, then you should look at this link:
    http://download.oracle.com/docs/cd/E12524_01/relnotes.1013/e12523/oc4j.htmThere is a known issue when migrating from file-based to OIM\OID. Navigate to:
    12.2 JAZNMigration Tool Does Not Migrate ADFPrincipal Type Correctly
    -Michael

  • Cannot start OC4J instance - after java.lang.OutOfMemory errors

    Hi, I have successfully deployed an application (using Oracle Web Services, J2EE - EJB, TopLink ) to a new OC4J instance that we created. We use the OEM web site to manage the start/stop and deploy operations.
    Then we tried to run simultaneously 10 clients....against the server app... ran ok for a while and after approx. 5 to 10 min... java.lang.OutOfMemory errors were being thrown at the client.
    After a set of OutOfMemory errors, other clients received errors like the ones show below:
    Errors from the top link log
    2003.09.24 09:39:59.630--ClientSession(1337286)--Thread[ApplicationServerThread-6,5,main]--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Bigger type length than Maximum
    INTERNAL EXCEPTION: java.sql.SQLException: Bigger type length than Maximum
    ERROR CODE: 17412LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Bigger type length than Maximum
    INTERNAL EXCEPTION: java.sql.SQLException: Bigger type length than Maximum
    ERROR CODE: 17412
    at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
    at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.selectOneRow(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRowFromTable(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRow(Unknown Source)
    2003.09.24 09:40:02.365--ClientSession(1337286)--Thread[ApplicationServerThread-6,5,main]--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Refcursor value is invalid
    INTERNAL EXCEPTION: java.sql.SQLException: Refcursor value is invalid
    ERROR CODE: 17442LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Refcursor value is invalid
    INTERNAL EXCEPTION: java.sql.SQLException: Refcursor value is invalid
    ERROR CODE: 17442
    at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
    at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.selectOneRow(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRowFromTable(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRow(Unknown Source)
    at oracle.toplink.queryframework.ReadObjectQuery.execute(Unknown Source)
    at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
    at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)
    2003.09.24 09:40:03.553--ClientSession(6073931)--Thread[ApplicationServerThread-23,5,main]--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Protocol violation
    INTERNAL EXCEPTION: java.sql.SQLException: Protocol violation
    ERROR CODE: 17401LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Protocol violation
    INTERNAL EXCEPTION: java.sql.SQLException: Protocol violation
    ERROR CODE: 17401
    at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
    at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
    2003.09.24 09:41:15.173--ServerSession(3066938)--Thread[ApplicationServerThread-19,5,main]--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01403: no data found
    INTERNAL EXCEPTION: java.sql.SQLException: ORA-01403: no data found
    ERROR CODE: 1403LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01403: no data found
    INTERNAL EXCEPTION: java.sql.SQLException: ORA-01403: no data found
    ERROR CODE: 1403
    at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
    at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
    Im not sure if this is due to a memory leak or something in my app ? Or does Oracle IAS / Toplink have any such issues for which any possible patches are available ?
    Could anyone please direct me in the possible right direction !
    Thanks,
    Krishna

    Hi,
    We have had this problem too, it only started after we deployed to production and got some load on our application server. We are using JRun as our application server.
    We found that Macromedia (JRun) already addressed the issue in general - that if you get java.lang.OutOfMemory errors, then you need to increase the heap size.
    Previously we had been using our own caching mechanism and never ran into this problem. Since we decided to go with TopLink (which has caching) we no longer use our own caching mechanism... but now we have this problem.
    We have chosen to use FullIdentityMap for caching, but didn't think we would run out of memory in the JVM. Is there a suggested or minimum JVM memory requirement to run TopLink?
    Thanks,
    Aaron

  • Cannot merge calls with iphone5

    Cannot merge calls even after i updates the ios to 7.1

    What you are talking about is a carrier function.  Make sure that your account is properly set up by them.

  • TS3103 I have aol and cannot acesss my email after updating to osx 10.6. the help says that I need mail 4.6. I have 4.5.  How do I get the correct version?

    Ihave aol and cannot acesss my email after updating to osx 10.6. the help says that I need mail 4.6. I have 4.5.  How do I get the correct version?

    Run all software updates.
    http://support.apple.com/kb/TS4424

  • I have uninstalled and reinstalled iTunes Version 11.4.1 and still cannot access. I continue to get the Error 7 Windows Error 193 and now I am getting the Apple Mobile Device failed to start. I can't access any of my music I HAVE PURCHASED. What  to do?

    I have uninstalled and reinstalled iTunes Version 11.4.1 and still cannot access. I continue to get the Error 7 Windows Error 193 and now I am getting the Apple Mobile Device failed to start. I can't access any of my music I HAVE PURCHASED. What  to do?

    I am getting the same error message - error 7, Windows error 193 running iTunes on a PC Laptop (HP) which has been running iTunes previously for at least 2 years. 
    I followed the Apple support page and uninstalled (in order) all Apple programmes specified, rebooted, then re-installed.  Two additional errors crop up in re-installation, the first one is to do with Apple Mobile Support Device Services.  It seems that this might be rectified by plugging in said devices before finishing the re-install.  The second reads iTunesHelper was not installed correctly please re-install iTunes.  This persists. I cannot uninstall iTunesHelper using the Control Panel, but I can delete it using Windows.  However, after re-installing again, it still won't run and the original error comes back.  I've downloaded and uninstalled 15 times now and this is taking far too long to be acceptable. 

  • HT1478 i get a message when trying to sync..."requried disk cannot be found" even after enableing disk use

    i get a message when trying to sync..."requried disk cannot be found" even after enableing disk use

    First make sure you are using the most up to date version of iTunes and have all the latest Windows updates/patches installed on your PC.  From there, try again and if still no luck, make sure you are plugging your iPod into a high powered USB 2.0 port.
    Otherwise try these steps:
    1. Run “c:\WINDOWS\system32\devmgmt.msc” (i.e. *Device Manager*), and leave it open for now for later use
    2. Start up iTunes
    3. Next, connect your iPod.
    4. Go to your iPod Settings and select the “Enable disk use” option from under theSummary tab.
    5. A dialog box will pop up reminding you that you’ll need to manually eject. Go ahead and hit OK
    6. Hit Apply to save changes to the iPod
    7. Quickly switch to the Device Manager window and right-click on any item within the window and select “Scan for hardware changes”
    8. Finally, switch back to iTunes, and try re-syncing your iPod to see if it helped.
    It might not also hurt to trash your iPod's Photo cache if it has one (i.e. you sync photos to the iPod).  See this article for information on where to find this folder on your Windows XP machine.
    http://support.apple.com/kb/TS1314
    B-rock

  • So I updated the itunes and now it won't open it, it states a message "the itunes library.itl" cannot be open because it was created by a newer version of itunes, I have unistalled and re-installed newer and older version and still i get this message.

    I updated and now i can't use the itunes. I have unistalled several times, installing newer and older versions but still i get this message. Is there anything i can do to fix this problem??

    Try the following user tip with that one:
    Empty/corrupt iTunes library after upgrade/crash

  • After installing the latest version of ITunes I get an error message that says this application has failed to start because MSVCR80.dll was not found.  how do I get Itunes to start working again?

    After installing the latest version of ITunes I get an error message that says this application has failed to start because MSVCR80.dll was not found.  how do I get Itunes to start working again?

    See... Unable to install or open > http://support.apple.com/kb/TS5376
    Also See this User Tip by turingtest2
    https://discussions.apple.com/docs/DOC-6562

  • After installing a new version of Firefox, I get the error message "The procedure entry point JS_GetOperationLimit could not be located in the dynamic link library js3250.dll" when I try to start firefox. Elsewhere in the forum a complete reinstall is su

    After installing a new version of Firefox, I get the error message "The procedure entry point JS_GetOperationLimit could not be located in the dynamic link library js3250.dll" when I try to start firefox. Elsewhere in the forum a complete reinstall is suggested; however, I can't do that because of my company's IT policies. Is there any way to solve this problem WITHOUT a complete reinstall? Thank you!
    == This happened ==
    Every time Firefox opened
    == I installed a new version ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)

    If you can't reinstall Firefox yourself then you need to contact your IT department and ask them to check the Firefox installation.
    It is possible that some files got broken with the latest update.

  • I cannot do a software update, I get as far as System Updates then when I choose it a message appears say  "Check for update is not available at this time"  but I have not had a system update for a good while now.  I am on System version 6.16.211.XT912.Ve

    I cannot do a software update, I get as far as System Updates then when I choose it a message appears say  "Check for update is not available at this time"  but I have not had a system update for a good while now.  I am on System version 6.16.211.XT912.Verizon,en,US

    Which phone model?

  • After I've upgraded my iPhone iOS to 5.0.1, I got problems with connectivity. If my iPhone lose network, then it gets frozzen and I cannot make calls. After restart the telephone still does not work.

    After I've upgraded my iPhone iOS to 5.0.1, I got problems with connectivity. If my iPhone lose network, then it gets frozzen and I cannot make calls. After restart the telephone still does not work.

    1. Download the iOS 5.0.1: http://www.tobias-hartmann.net/2011/11/download-ios-5-0-1-veroffentlicht-direkte -downloadlinks/
    2. open itunes,Click in iTunes while holding down the Shift key (on Windows) or Alt key (Mac) to restore and firmware

  • When I tried to download the new version of firefox I get an error message that says "you computer must be restarted to complete an earlier upgrade" when I restart it says the same thing. I cannot use firefox at all at the moment.

    When I tried to download the new version of firefox I get an error message that says "your computer must be restarted to complete an earlier upgrade" when I restart it says the same thing. I cannot use firefox at all at the moment. When I try to uninstall in the control panel, the same message pops up.

    If you have problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the DMG file to the desktop
    * Firefox 5.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so you won't lose your bookmarks and other personal data.

  • I purchased Adobe Acrobat XI Pro - Student and Teacher Edition but cannot activate it even after it has deactivated and replaced my old Acrobat 8. How do I get a serial number and activate the product?

    I purchased Adobe Acrobat XI Pro - Student and Teacher Edition but cannot activate it even after it has deactivated and replaced my old Acrobat 8. How do I get a serial number and activate the product?

    I have the same  problem. Have paid. Messages say I have downloaded it but the file is inaccessible apparently download is somewhere on my hard disk. How do I find it?? Is there not help at an Adobe phone service. If so what is the number to call??
    Roger Broughton

  • Hate iTunes 11. Reverted to old version. Now I get error msg when I open that says The file "iTunes Library.itl" cannot be read because it was created by a newer version of iTunes but won't open or play songs.  HELP!!!!

    Hate iTunes 11. Reverted to the old version. Now I get a msg when I click to open iTunes stating, "The file "iTunes Library.itl" cannot be read because it was created in a newer version of iTunes" and it will not open.  HELP!!  How can I revert the library as well?

    I hate iTunes 11 too... and I also want to revert to previous version. But Apple seems to be so incredibly customer-friendly these days that is quite deliberately not publishing clear/simple revert instructions. I think it's a disgrace that Apple removed Cover Flow without warning people who are tempted to upgrade. Absolute disgrace. And now we're stuck with this piece of ..

Maybe you are looking for

  • Printing same smartform with different set of records continuously.

    Hi SDNer, Suppose a table contain Studet info like the following one: ID   Name    Sub1       Sub2     Sub3 1    xxx        sb11       sb12     sb13 2    yyy        sb21       sb22     sb23 3    zzz        sb31       sb32     sb33 Think that the smar

  • DVD from 720p project

    I have a 1280 x 720 HD project (ProRes 422) and need to export for SD DVD in 16x9 letterbox. What work flow will yield best quality in the correct aspect ratio? My sequence settings: HDTV 720p 16x9 preset; ProRes 422 codec; square pixels; no field do

  • Photos on AppleTV

    For years i synched pictures from my iMac to my AppleTV for viewing without a problem. It was actually my favorite feature. Since upgrading to iTunes 10 this feature has become dysfunctional. iTunes doesn't know the correct number of pictures to sync

  • Difficulty opening old projects.  Disk too slow, bad files, etc...

    Recently I've been trying to update old song files. I have a bunch of projects from Logic 6 that have trouble in Logic 7. I get tons of "Disk too slow or System Overload" errors and Logic Crashes quite a bit as a result. The songs aren't overly proce

  • Problems with downloads in Safari after QT 7.1.1 update

    Until I installed the QT 7.1.1 update a couple months back, I never had a problem downloading mp3 files from some websites using Safari. Now on these sites Quicktime will pop up and play the file if I click the mp3's download button. If I go into Saf