Row was updated or deleted by another transaction

Row was updated or deleted by another transaction

While working with hibernate (which is quite popular java object relational mapper), you might have stumbled upon this exception:

Row was updated or deleted by another transaction

What does this exception really mean? Well, you're most probably trying to update an object via hibernate which was version ID is lower than version ID of object in the database.

Hibernate uses versioning to know that modified object you had is older than one which is currently persisted.

Hope this will help some java newbies which are using hibernate for persistence.

What is the solution to "row was updated or deleted by another transaction" then?

Solution

You need to get the very latest version of object to avoid "row was updated ... " exception before you make any changes.

This can be usually accomplished by adding:

MyEntity myEntity = persistenceManager.findObjectById(myEntity .getId())

here goes then:

persistenceManager.update(myEntity);

on your hibernate persistence manager


Related Posts



188BET - LINK 188BET CASINO sitemap sbobetasia OneBet empire777 pantip W88 918kisslogin 1XBETsports w88 slot
www.ajgsportstalk.com| www.openrangephotos.com| www.jiudianzhaopin.com/vipjt91x.html| www.locksmithdecaturga.net| www.dfwl.org| www.jiudianzhaopin.com/vipbf/vt99d| www.prow88th.com| www.jiudianzhaopin.com/bbbbf/iomom/| www.akcicekyapi.com| www.greenfieldtours.com| www.inthezonewellness.com| www.jiudianzhaopin.com/bbb/sitemap.htm| www.jiudianzhaopin.com/bbb7htl9.html| www.itjie.com/bbsku/jrpbj| www.wangshangsongxi.com| www.jiudianzhaopin.com/bbbfg/7195.html| www.jiudianzhaopin.com/vipbf/11r7n| www.jiudianzhaopin.com/vipbf/11r7n| www.jiudianzhaopin.com/vipcs/sinx| www.mcleanlaneman.com| www.hongw88.com| www.dorianseniors.com| www.jiudianzhaopin.com/vipvn75j.html| www.grishamgaines.com| www.franklinbusybody.com| www.truthofyoursoul.com| www.jiudianzhaopin.com/viperw/393.html| www.weareprettypleased.com| www.jiudianzhaopin.com/bbbmgy/5h5v/| www.jiudianzhaopin.com/viperw/519.html| www.sonicemeetingyou.com| www.akcicekyapi.com| www.itjie.com/hotpo/04uw0| www.stripeatyellow.com| www.itjie.com/bbstxnz.html| www.bostonvoicedata.com| www.360w88.com| www.cheerfuLkashmir.com| www.jiudianzhaopin.com/viphlagd.html| www.jiudianzhaopin.com/vip| www.jiudianzhaopin.com/viperw/519.html| www.itjie.com/bbsdtux.html|