Re: Get PK value of a previously generated object

2010-08-09 Thread Mike Kienenberger
It's actually much easier than that. // Create main object // Create child object mainObj.setChild(childObj); This will automatically set the correct PK and FK values. You can also commit both changes at the same time rather than separately. On Mon, Aug 9, 2010 at 12:11 PM, mr.abanjo wrote:

Get PK value of a previously generated object

2010-08-09 Thread mr.abanjo
Hi, my application need to generate a "parent" object and then create a "child" object that contains the PK value of the parent. I'm using MySQL and the colum "id" is "autoincrement". ( both tables ) So first i create the main object (it extends DataObject ): MainObject mainObj = new MainObject()

Re: Rollbacks and Listeners

2010-08-09 Thread Andrus Adamchik
On Aug 9, 2010, at 6:08 PM, Bruno René Santos wrote: I have been analyzing the behaviour of the commitChanges lifecycle and inferred that only when all database operations that are contained on the current context are successfully performed do the post... callbacks are called. Correct.

Re: Rollbacks and Listeners

2010-08-09 Thread Mike Kienenberger
I handle error trapping on the commit statement. If it throws an exception, then I do something about it. Rollbacks in practice over the last few years have almost always been due to the loss of the ability to change database records (network issues, database server issues), so logging has to oc

RE: Rollbacks and Listeners

2010-08-09 Thread Bruno René Santos
I have been analyzing the behaviour of the commitChanges lifecycle and inferred that only when all database operations that are contained on the current context are successfully performed do the post... callbacks are called. So if you have like 4 inserts on the context and one of them raises an exc

Re: Rollbacks and Listeners

2010-08-09 Thread Joe Baldwin
Wouldn't an important business-concern (or rule) be that if there was indeed a rollback, then one might want to log it (via a Cayenne insert)? I am doing something like this right now and it is a tad tricky. On Aug 9, 2010, at 10:37 AM, Mike Kienenberger wrote: > On Mon, Aug 9, 2010 at 5:41

Re: Rollbacks and Listeners

2010-08-09 Thread Mike Kienenberger
On Mon, Aug 9, 2010 at 5:41 AM, Bruno René Santos wrote: > Im using cayenne on a banking system, where commits and rollbacks are > critical. > I was thinking about using cayenne callbacks to include the creation of logs > during database operations. My doubt is what happens when there is a rollba

Re: Web site link to example and a proposal for a new example link

2010-08-09 Thread Andrus Adamchik
Hi Martin, I see. I guess the concept of a "framework as an example" wasn't immediately clear to me. Now I added a link to Yafra to the examples page. Thanks a lot for your work! Andrus On Aug 8, 2010, at 11:16 PM, Martin Weber wrote: Hi Andrus, agree with your point, wrong location and

Re: Rollbacks and Listeners

2010-08-09 Thread Andrey Razumovsky
I meant callbacks are not called during rollback :) 2010/8/9 Andrey Razumovsky > Hi, > > Unless something's changed, callbacks are not called during callback. Also > note that only "post" callbacks can tell for sure that DB operations had > happened > > 2010/8/9 Bruno René Santos > > Hello all

Re: Rollbacks and Listeners

2010-08-09 Thread Andrey Razumovsky
Hi, Unless something's changed, callbacks are not called during callback. Also note that only "post" callbacks can tell for sure that DB operations had happened 2010/8/9 Bruno René Santos > Hello all, > > > > Im using cayenne on a banking system, where commits and rollbacks are > critical. > I

Rollbacks and Listeners

2010-08-09 Thread Bruno René Santos
Hello all, Im using cayenne on a banking system, where commits and rollbacks are critical. I was thinking about using cayenne callbacks to include the creation of logs during database operations. My doubt is what happens when there is a rollback on the database during a transaction in terms of