You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Juan Manuel Diaz Lara <jm...@yahoo.com.INVALID> on 2018/05/06 15:20:29 UTC

How to integrate a stored procedure call with commitChanges or cayenne transaction ?

The purpose is to use db stored procedures to do the post-processing of my object graph, something like (seudo-code);

start cayenne transaction
     cayenne commitChanges();
     call stored procedure/function to post-process (heavy process).
commit cayenne transaction

I would be nice that if stored procedure fails then object graph remains in the state just before transaction started (at least the persistence state).


Atte. Juan Manuel Díaz Lara

Re: How to integrate a stored procedure call with commitChanges or cayenne transaction ?

Posted by Andrus Adamchik <an...@objectstyle.org>.
You should be able to run Cayenne commit and a stored procedure in the same DB transaction (either via lifecycle events or manual transaction API), but unfortunately it is not possible to preserve the object state on rollback. 

Maybe we should think about such scenario in the future. I can see it being useful...

Andrus


> On May 6, 2018, at 6:20 PM, Juan Manuel Diaz Lara <jm...@yahoo.com.INVALID> wrote:
> 
> The purpose is to use db stored procedures to do the post-processing of my object graph, something like (seudo-code);
> 
> start cayenne transaction
>      cayenne commitChanges();
>      call stored procedure/function to post-process (heavy process).
> commit cayenne transaction
> 
> I would be nice that if stored procedure fails then object graph remains in the state just before transaction started (at least the persistence state).
> 
> 
> Atte. Juan Manuel Díaz Lara