>I also had a situation where OpenJPA fired updates on unchanged entities after committing the transaction, for all fields all the time.
For instance, one pojo only had 2 string fields and a Long primary key. OpenJPA updated both string fields after the commit. I'm using the extended persistence context without any versioning, and the only configuration I set is the JDBC connection properties. Unfortunately I fixed it without figuring out where exactly the problem was. Sorry. I think what I had done is to begin a transaction, commit it, and then start another and whatever I pulled into the second transaction, OpenJPA did an update on. If you think this is worth putting a test case together for, let me know. I wasn't quite sure whether running a second transaction after the first on the same entity manager was legitimate according to the JPA spec. Regards Adam Shelley <[EMAIL PROTECTED]> writes: > > I am seeing a similar issue with OpenJPA unnecessarily calling an UPDATE on > every commit. > > It appears that on every commit(), all of my entity's Date fields > (TemporalType.TIMESTAMP) are being updated even though they have not > changed. > > UPDATE MY_ENTITY SET timeField = ?, version = ? WHERE id = ? AND version = ? > [params=(Timestamp) 2007-12-05 15:08:18.927, (int) 2, (int) 50, (int) 1] > > My current workaround is to clear the persistence context after each commit, > but this obviously is not desirable and shouldn't be necessary. Any ideas > as to why this might be occurring, or how to prevent it? I am using the > majority of default OpenJPA properties (version LockManager, optimistic > locking, etc), although I have attempted to modify some of these properties > to prevent this problem, so far with no success. > > Marc Siegel wrote: > > > > Hi Patrick, > > > > Thanks for your response. > > > > As I mentioned in the FetchType.LAZY thread, I am using: > > - java 1.5 > > - field access > > - no build-time enhancement > > - no javaagent commandline > > - maven to build > > > > Eagerly (or lazily?) awaiting your advice on a more stable setup for > > using OpenJPA 1.0 in either thread! > > > > Regards, > > -Marc > > > > > > On 11/1/07, Patrick Linskey <[EMAIL PROTECTED]> wrote: > >> How are you deploying your app (JDK version, are you using an appserver, > >> etc.)? > >> > >> Are you running the OpenJPA enhancer? > >>
