Re: Obtain primary key for DataObject before commitChanges

2015-08-27 Thread Hugi Thordarson
I like the simplicity of this approach. Makes me think I might be designing myself to hell with my somewhat convoluted multi-table monstrosity :). Cheers, - hugi On 12. ágú. 2015, at 15:05, Mike Kienenberger mkien...@gmail.com wrote: On Tue, Aug 11, 2015 at 8:49 PM, Aristedes Maniatis

Re: Obtain primary key for DataObject before commitChanges

2015-08-27 Thread Hugi Thordarson
Hi Ari, sorry for the late replies to those, I had to back out to a different project for a couple of weeks. * What is the purpose of TransactionObject? It’s to serve as a metadata store for the original object. For example (something I didn’t mention originally) it stores a human readable

Re: Obtain primary key for DataObject before commitChanges

2015-08-27 Thread Hugi Thordarson
For INSERTs, are you planning on storing all of the original values in TransactionObjectFieldValue rows? Yes - hugi

Re: Obtain primary key for DataObject before commitChanges

2015-08-12 Thread Mike Kienenberger
On Tue, Aug 11, 2015 at 8:49 PM, Aristedes Maniatis a...@maniatis.org wrote: I'm interested in a different part of the problem you are solving. Other than the relationship data discuss here, how are you storing the actual changes in your audit table? Does your problem just require Bob changed

Re: Obtain primary key for DataObject before commitChanges

2015-08-12 Thread Hugi Thordarson
For the last few years while using EOF, I’ve been storing changes in the audit log as a map serialized to a String NSPropertyList (the NS* world’s equivalent of JSON). It works fine, but once the log starts to grow, there are performance implications. This time around I’m going for a three

Re: Obtain primary key for DataObject before commitChanges

2015-08-12 Thread Aristedes Maniatis
Interesting. Questions: * What is the purpose of TransactionObject? * Is there a performance advantage to TransactionObjectFieldValue with multiple rows per change event rather than storing larger json serialised set of changes in one record? I mean, I understand that it allows you to ask what

Re: Obtain primary key for DataObject before commitChanges

2015-08-12 Thread Michael Gentry
For INSERTs, are you planning on storing all of the original values in TransactionObjectFieldValue rows? On Wed, Aug 12, 2015 at 4:18 AM, Hugi Thordarson h...@karlmenn.is wrote: For the last few years while using EOF, I’ve been storing changes in the audit log as a map serialized to a String

Re: Obtain primary key for DataObject before commitChanges

2015-08-11 Thread Hugi Thordarson
Thanks for the ideas Mike. After a little mulling, I think your idea of dynamically modeling relationships to the audit table at application startup is the best one I’ve heard so far. I’m going to take a peek down that road tomorrow :) Cheers, - hugi On 10. ágú. 2015, at 14:24, Mike

Re: Obtain primary key for DataObject before commitChanges

2015-08-11 Thread Aristedes Maniatis
I'm interested in a different part of the problem you are solving. Other than the relationship data discuss here, how are you storing the actual changes in your audit table? Does your problem just require Bob changed record 23 or are you keeping a complete diff of the changes? If the latter,

Re: Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Mike Kienenberger
Not sure if it's clear, but there are two different approaches to your problem described. 1) You can set a foreign relationship to your audit table and let Cayenne assign the key at commit. This is probably the easiest especially if you dynamically create the relationships in java code. Except

Re: Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Mike Kienenberger
I set up auditing using a different approach in one project many years ago back in Cayenne 1.1, and I've continued using it up to this point in 3.x. I generated special setter, addTo, and removeFrom methods as well as a create method which created the logger object at that point. To get the

Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Hugi Thordarson
Hi all. Is it possible for me to obtain the primary key for a Cayenne DataObject before committing changes? I’m writing an audit log and I need the key for the object during PrePersist (where I’m constructing the log object). Cheers, - hugi

Re: Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Aristedes Maniatis
On 10/08/2015 8:31pm, Hugi Thordarson wrote: Is it possible for me to obtain the primary key for a Cayenne DataObject before committing changes? I’m writing an audit log and I need the key for the object during PrePersist (where I’m constructing the log object). How will it have a primary

Re: Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Hugi Thordarson
Is it possible for me to obtain the primary key for a Cayenne DataObject before committing changes? I’m writing an audit log and I need the key for the object during PrePersist (where I’m constructing the log object). How will it have a primary key before the record is written to the

Re: Obtain primary key for DataObject before commitChanges

2015-08-10 Thread Hugi Thordarson
Thanks Mike! Although the approach I’m working on is a little different (and meant to be reusable with any Cayenne installation so can’t depend on superclass template modifications), it’s very helpful to see code from other Cayenne folks. Cheers, - hugi // Hugi Thordarson //