I've seen this, too. OpenJPA guys? Shouldn't we be able to update the @Version field in a preupdate method?
On Tue, Sep 21, 2010 at 5:35 PM, Kelvin Law <[email protected]> wrote: > Hi, > > I have a MappedSuperClass which has a @PreUpdate annotation on a method. > > The @PreUpdate method only has one line like below: > > this.updateTime = new Date(); > > (and updateTime is actually mapped to a column) > > I noticed that there are some unnecessary sql being generated when I tried to > update the entities... > > For example: Update SOME_TABLE set UPDATE_TIME = <some_date> where ID = ? and > VERSION = ? > > And because of this sql statement, OpenJPA will throw JpaOptimisticLocking > (because it cannot update the entity with the specific version). > > I have tried to comment out the @PreUpdate method then everything works fine. > (except that I cannot have the last modified time of the entity). > > So my question is, is this a bug? and is there any work around for that? > > I am using OpenJpa 1.2.2 > > Thanks > Kelvin > > -- mailto:[email protected] skype:matthewadams12 yahoo:matthewadams aol:matthewadams12 google-talk:[email protected] msn:[email protected] http://matthewadams.me http://www.linkedin.com/in/matthewadams
