Coping with the exception of optimistic locking in OpenJPA...?
Hi allI have the code example that I'm calling from the main class (I don't use any server/container)
public void updatePortName(String oldPortName, String newPortName)
{
EntityTransaction trx = em.getTransaction();
trx.begin();// Checkpoint
BcsPrimaryBuffer bcsPrimaryBuffer = (BcsPrimaryBuffer) em.find(BcsPrimaryBuffer.class,
oldPortName);
bcsPrimaryBuffer.setPort(newPortName); // IS THIS CORRECT ???
em.merge(bcsPrimBuffer);
trx.commit(); //Throws exception
}
I get the following exception on trx.commit ()...My question is that I take the right approach here... ?
I need to update the port value in the BcsPrimaryBuffer table in db to the new value.
If need more info please let me know.
Exception in thread "main" <openjpa-1.0.0-r420667:568756 fatal store error> org.apache.openjpa.persistence.RollbackException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [org.apache.openjpa.enhance.entities$BcsPrimaryBuffer$pcsubclass-JCVLFLU0523HD2160033-1-1-2-1]
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:419)
at entities.BcsPrimaryBufferDAO.updatePortName(BcsPrimaryBufferDAO.java:194)
at com.test.local.EntityManagerTester.main(EntityManagerTester.java:36)
Caused by: <openjpa-1.0.0-r420667:568756 nonfatal store error> org.apache.openjpa.persistence.OptimisticLockException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [org.apache.openjpa.enhance.entities$BcsPrimaryBuffer$pcsubclass-JCVLFLU0523HD2160033-1-1-2-1]
at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2096)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1946)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1844)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1762)
at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1292)
at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:861)
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:408)
... 2 more
Ok
so your idea of "delete the entity with the old port number, insert a new one with the new port number" would be a good solution
Tags: Java
Similar Questions
-
None of my function keys (F1 - F12) works with the exception of the ESC key. They worked fine yesterday, but now they do not have.
How can I fix this?
I use the SHIFT + F7 work much and would really appreciate help in getting up and running.
Thank you
Check if you have an F LOCK key in the top right of your keyboard.
If this is not the case, try a system restore:
Restore point:
http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/
Do Safe Mode system restore, if it is impossible to do in Normal Mode.
Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.
Try a restore of the system once, to choose a Restore Point prior to your problem...
Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.
See you soon.
Mick Murphy - Microsoft partner
-
Boxes (with the exception of the first page of comments) YouTube comments are insensitive/gray. Google have not responded to my request, can advise you please? Running Ff in "Safe Mode" makes no difference, or reload the page.
The URL is just one example, the first series of observations, I can meet next & following I can't.Thanks for your help,
Dick Holman
[email protected]p.s. I can sometimes get the comment boxes to work if I allow third party cookies.
-
Update firefox9. Using tree style tab extension. Everything works fine, except that my screen goes black when in 'tab window', with the exception of the window of the tab and the part of the screen behind him. Once out of the tab section everything comes back fine, but it is rather annoying. Checked homepage for the extension and have the updated version, firefox add-on page - it also says that it is compatible. Any ideas on that?
Am realizing pages will stay on as long as I don't move the mouse,but as soon as I do move it,black goes the screen.
Ok. A installed version 1.4? Manufacturers homepage. This is apparently what caused problems. Get rid of this and installed version 1.3? Since firefox add on the pages. Problems solved...
-
I just upgraded to El Capitan, which automatically "upgraded" iPhoto in Photos. Now when I open the pictures, my thumb nails is blurred with the exception of those that have been previously published in iPhotos. When you click on a fuzzy thumbnail to select it, the picture is very good. The photos were initially imported into iPhoto via the camera memory card to JPEG. Is there a way to fix this? I take lots of photos for a local spca and this will really slow me down in the decision-making process on the pictures to use. I'm not a very tech savvy person any help with this is greatly appreciated!
If you pick a few and twist and turn then back it is this resolved? -If this is the case you can do in large groups for the problem photos
LN
-
It seems that almost all of the shows on Apple TV are in stereo with the exception of a few films. Is this true?
Most of the TV shows for a few years now, were made with stereo and enough tracks all the movies since the 1980s (and some back to 1955).
-
I've updated VIA / S3G UniChrome IGP plug-and-play reverse, but the update still no resolution 1600 x 1200 with the exception and others with the same ratio of 4 x 3. That did not help.
Hello
- What version of Windows are you using?
- What is the brand and model of the computer?
I suggest to run the patch from the following link and check the status of the issue.
Hardware devices do not work or are not detected in Windows.
http://support.Microsoft.com/mats/hardware_device_problems/en-us
If the problem persists, I suggest you to send us more information to help you better.
-
W7 Upgrade Advisor said it would work with the exception of Windows Aero. When the games to try to come with W7 get window 'game running in software rendering... '. Hardware acceleration disabled or not supported by the video card driver"games will not work. A check says last drivers are installed. Tried to reinstall WXP in separeat partition to see if would work like that but will not because most recent W7.
I suggest that you use XP personally gave a computer which is so old.
If you have a computer with XP (3 + years) and have not changed at least two of these things (CPU, RAM, video card), you should probably stick with XP. Not worth the headache of praying that things work with a material more old which probably is no longer supported on the new OS.
Usually, people that the computer was shipped with Vista 1, 2 or less it several years ago can be upgraded to 7 without too much trouble if it was a mid-range machine.In addition, it seems that Windows is not recognizing your graphics card. It looks like (http://www99.shopping.com/xPO-Hewlett-Packard-SR1020NX-CEL2-8-512-80-COM-XPH) you have an Intel Extreme graphics card. However, nothing about it is extreme. Since it is an extreme Intel card I guess Windows Update should find the drivers for you, but it is not then maybe the video card is just too outdated for 7? I'm not sure.
Moreover, I wouldn't worry much about the lack of updates for XP right now. If ever you encounter more money then get the new computer with 7 on it, but at this time I suggest you stay on XP if your hardware and software actually works and that is more important than a few features of 7.
-
I lost all the games with the exception of Freecell on my computer
I lost all the games with the exception of Freecell on my Dell 8200 Windows XP computer. I followed the guidelines to reinstall using Add/Remove Programs, Windows Components and it said: everything is fine, but the games are never as far as I can tell.
Thoughts?
original title: games
I found that I had to delete the games that were not there before I could add them.
-
I lost all the file associaation, with the exception of aol, how do I add these files?
Hello
1. what happens when you try to open a program?
2. have you made changes on the computer recently?Try the steps listed in the article below and check.
How to change or choose the program that starts when you double-click a file in Windows XP
http://support.Microsoft.com/kb/307859I hope this helps.
-
What does the acronym for error 800F020B code?
I tried to update my new S3 Galaxy and some updates succeeded with the exception of
one with the error 800F020B code. It holds until the completion of the update. Help, please
as I'm not in the computer. Thank youIf the update is for your 3 contact your telephone service provider or Samsung Galaxy.
-
I use verizon as a server with their security suite. I can receive emails with any address with the exception of hotmail addresses. I put the filters for hotmail, but I can not receive emails from anyone with a hotmail account. Any ideas or suggestions?
Thank youHi DonaldMagaw,
When you use Windows Live Hotmail and the question you have posted is related to Windows Live, so it would be better suited in the Windows Live community. Please visit the link below to find a community that will provide the best support.
Windows Live Solution Center Hotmail Portal
http://windowslivehelp.com/product.aspx?ProductID=1
I hope this helps.
-
HP Deskjet F2210 printer will not print my documents with the exception of my e-mail highlighted
HP Deskjet F2210 printer will not print my documents with the exception of my e-mail address highlighted who is on the document, it is not cartrages, as it will print one page black and multicolor of the internet. Help, please.
If you found problems with print quality with the only printer without printing from the computer, then it is a hardware problem.
You may need to contact HP (1800-474-6836) support. Looks like a print head may be bad or needs to be cleaned manually. I don't think that this printer has a detachable printhead to clean manually.
-
I get the blue screen with the exception of system Service in Windows 8. It seems that many people have of it. I can't use my computer without losing all the data every few minutes. It is brand new. Fix? It often happens with Firefox, but other times too and restarts sometimes when you type an e-mail in the e-mail of Windows 8 program.
For this recent System_Service_Exception error, if you have an AMD graphics card try the next tool from AMD to try to get the latest graphics driver:
http://support.AMD.com/us/gpudownload/Windows/pages/auto_detect.aspx
According to me, a recent update of Windows, maybe the 2778344 which updates win32k.sys to the 6.2.9200.16503 version, could cause a conflict with the AMD graphics driver.
Many users report the same error recently and so far have all AMD/ATI graphics cards.
If all goes well the graphic driver update will help.
If the problem persists, consider uninstalling 2778344.
Then, at the moment, 'hide' 2778344.
-
I get this kind of error: U44M1l210 when I try to install programs with the exception of Lightroom and Acrobat reader Pro. Why do I need to change the installation of you accomplished?
Ford Hi,
Please visit the Doc KB: error U44M1I210 | Install updates
Kind regards
Rave
Maybe you are looking for
-
Users/HP, Hello fellow forum members I just bought a new laptop from HP 15-d035dx like a beam from BestBuy. Preinstalled with OS Windows8.1 (my first time using it) and I immediately rejected and decided to install my copy of Windows 7 Pro. I took al
-
COM PORT is missing in Device Manager
When I have found that on that day there, I opened Device Manager, devices mobile COM port option has disappeared from the Device Manager. This who should I do to solve this problem...
-
Each program has shunk expands on my 17 "display Desktop. nothing no longer uses the ability of screen size? I tried adjusting the size of resolution and display text - no help.
-
Guard remote office Session disconnect
Hi, I've set up a Windows Server 2012 R2 as a Hyper-V host computer for my virtual machines. Access to remote desktop session host, but the session keeps disconnecting after a few minutes. My server has the following roles at present: Any suggestions
-
On the user process start/exit Windows memory leak
I have more question just ask why batch file back in before the current ordering process properly release the .exe file, I see that some memory is not released at all. In other words, once again, I create and execute processes in the loop (here, to i