cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Lewis <>
Subject Re: OptimisticLocking exception during cascade delete
Date Thu, 15 Apr 2010 18:43:26 GMT
Hmm, that's very strange.  Now the double deletion isn't happening.  I don't
think I changed anything relevant but I can't make it happen now.  Oh well,
never mind.

On Thu, Apr 15, 2010 at 12:32 PM, Bryan Lewis <> wrote:

> I have an entity Quote with a to-many relationship to QuoteCountry, and a
> cascade delete rule.  When I delete a quote object, Cayenne attempts to
> delete the QuoteCountry objects twice, I suspect because I also have a
> flattened relationship quote.countries (Quote -> QuoteCountry -> Country).
> I was googling for previous reports of this and found none, but I did come
> across an old copy of Cayenne's that explicitly checked for
> deleting twice in the presence of a flattened relationship.
> Normally this double deletion might not be noticed, but it throws an
> OptimisticLockException if optimistic locking is enabled on the Quote
> entity.  My current work-around is to disable OL on this entity only, which
> isn't a bad work-around for me.  BatchAction does:
>     int updated = statement.executeUpdate();
>     if (useOptimisticLock && updated != 1) {
>         //...
>         throw new OptimisticLockException(...);

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message