Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Michael Gentry
Hi Hugi, I was mainly interest in attributes, so that's all I coded up. I'm sure there is a way to take relationships into account, as well, but I'd have to code it up and test it and don't have time at the moment (maybe over the weekend). If someone else, including yourself, beats me to it, tha

Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Hugi Thordarson
Thanks a lot Michael, objectStore.getSnapshot( object.getObjectId() ); does almost exactly what I needed. One thing though, this code does not handle modifications to relationships, since my foreign keys are not modeled as attributes in the ObjEntity. Do you think there’s some way to get at cha

Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Michael Gentry
Hi Matt, Keep in mind you are using extra memory with this approach since Cayenne already has a snapshot of the original values. (It needs the snapshot data to do optimistic locking and to only send changed values in an UPDATE statement.) mrg On Fri, Aug 7, 2015 at 11:19 AM, Matt Watson wrote

Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Matt Watson
We do this by extending the CayenneDataObject class and introducing a HashMap that tracks the original value of the properties that have changed. Override the writeProperty/setToOneTarget (we only care about auditing attributes and belongsTo relationships. Then when it comes time to Insert/Updat

Re: DataSourceInfo

2015-08-07 Thread Joe Baldwin
I am using DHCP (and have been for years). This only started happening when I had my webhost upgrade to Tomcat 8 (and I converted to Cayenne 4). The connection mismanagement DOES NOT happen on my development server. This is why I am starting with verifying the JDBC version via Cayenne. Ho

Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Michael Gentry
Oh, and printDirty() actually dumps everything that is modified in the DataContext, which is kind of an uncommitted audit log. On Fri, Aug 7, 2015 at 10:33 AM, Michael Gentry wrote: > Hi Hugi, > > Maybe something like isIdenticalToSnapshot() in this Gist will help you? > > https://gist.github.c

Re: Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Michael Gentry
Hi Hugi, Maybe something like isIdenticalToSnapshot() in this Gist will help you? https://gist.github.com/mrg/4dce22b67175c27f4047 If I recall, this version is for Cayenne 3.0, so there might be a few tweaks needed for 3.1. mrg On Fri, Aug 7, 2015 at 10:16 AM, Hugi Thordarson wrote: > Hi al

Re: DataSourceInfo

2015-08-07 Thread John Huss
I think this is a "feature" of MySQL. It closes idle connections eventually. You can add a validationQuery to keep the connection active. On Fri, Aug 7, 2015 at 2:40 AM Joe Baldwin wrote: > Problem: I am having problems with MySQL connections being disabled > improperly on the production serve

Implementing and audit log using Cayenne; finding what was modified in an object

2015-08-07 Thread Hugi Thordarson
Hi all. I’m attempting to implement an audit log using Cayenne, automatically storing information on modifications alongside every insert, update and delete. I’m currently doing this by adding a listener on the DataDomain that watches for the lifecycle events PrePersist, PreUpdate and PreRemove

Re: Java 8 Date/Time API and Cayenne

2015-08-07 Thread Hugi Thordarson
Ah, thanks a lot for this! I’ll try it out once M3 is stable and published to central. Cheers, - hugi // Hugi Thordarson // http://www.loftfar.is/ // s. 895-6688 > On 7. ágú. 2015, at 08:17, Savva Kolbachev wrote: > > Yeah. You need to add the following dependency t

Re: Java 8 Date/Time API and Cayenne

2015-08-07 Thread Savva Kolbachev
Yeah. You need to add the following dependency to your pom.xml: org.apache.cayenne cayenne-java8 4.0.M3-SNAPSHOT Note: This is an 4.0.M3-SNAPSHOT version, so mvn repository doesn't contain java8 module. You need to build it by yourself. Then you need to create n

DataSourceInfo

2015-08-07 Thread Joe Baldwin
Problem: I am having problems with MySQL connections being disabled improperly on the production server (the development server does not show the same error). This happens only after an idle period (and only on the production server). java.io.EOFException: Can not read response from server. Exp