openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Adams <matt...@matthewadams.me>
Subject Re: PreUpdate on MappedSuperClass
Date Wed, 22 Sep 2010 12:50:19 GMT
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 <kai.law@gmail.com> 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:matthew@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@gmail.com
msn:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Mime
View raw message