You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrea Biasillo <ab...@dataloy.com> on 2016/05/10 12:37:17 UTC

Reordering of database operations causes violation of unique constraint

Hi!

My name is Andrea Biasillo, I am software architect in Dataloy AS, Bergen
Norway. In one of our project we use Cayenne as ORM. Unfortunately we are
facing the same problem reported by this case:

https://issues.apache.org/jira/browse/CAY-1898

Is  this case never  been taken in consideration? Is there a solution or at
least a work-wround?

Many regards

-- 

Andrea Biasillo - Dataloy Systems

P: +47 55 36 03 00

M: +4746542580 <%2B47%2055%2036%2003%2000>

Dataloy Service Desk <http://support.dataloy.com/>

Dataloy Knowledge Base <http://kb.dataloy.com/>

Subscribe to the Dataloy Newsletter <http://dataloy-systems.com/?page_id=591>

twitter.com/dataloy

www.dataloy-systems.com

Re: Reordering of database operations causes violation of unique constraint

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 10/05/2016 10:37pm, Andrea Biasillo wrote:
> Hi!
> 
> My name is Andrea Biasillo, I am software architect in Dataloy AS, Bergen
> Norway. In one of our project we use Cayenne as ORM. Unfortunately we are
> facing the same problem reported by this case:
> 
> https://issues.apache.org/jira/browse/CAY-1898
> 
> Is  this case never  been taken in consideration? Is there a solution or at
> least a work-wround?


I'm pretty sure that issue was found in one of my projects, and the workaround was just to rewrite the offending code to commit the delete before trying to insert an identical object. Or else just mutate the old object into the values you need.

That is, our workaround wasn't to hack Cayenne to reorder the queries, but just to break up the commits. Wrap them into a database transaction if you need to.

Ari




-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A