@Andy: not the question I think the point is mainly how do I keep version management when I use DTO in the front. You must push version until your DTO and handle it yourself.
That said you can just do the check this way: if (entity.version != dto.version) throw new ItWillFailException(); instead of setting version. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-05-14 20:19 GMT+02:00 agumbrecht <[email protected]>: > You should let the JPA provider manage the @Version field, don't try and > change it or read it yourself or you'll always get this error. It's > controlled internally by the provider and is to do with optimistic locking. > > If you want to manage your own entity version the, i.e. versioned data row, > then use a different name/field and treat it like any other field - Don't > flag it with @Version. > > Hope this helps. > > Andy. > > > > ----- > -- > Andy Gumbrecht > > http://www.tomitribe.com > [email protected] > https://twitter.com/AndyGeeDe > > TomEE treibt Tomitribe ! | http://tomee.apache.org > -- > View this message in context: > http://openejb.979440.n4.nabble.com/OpenJPA-and-DTO-problem-tp4669332p4669334.html > Sent from the OpenEJB User mailing list archive at Nabble.com.
