geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Keller <m.kel...@orcasoft.ch>
Subject Re: @Version and Query using version column cause trouble?
Date Sun, 23 Nov 2008 08:50:56 GMT
Hello Dirk

dbrenck wrote:
> Any idea why the following query fails?
> 
> Serverside:
> 
>  pu for xxxx classes  TRACE  [ejbd 10] openjpa.Query - Executing query:
> [SELECT entity FROM TypeEntity entity WHERE ( entity.id = :id ) AND (
> entity.version = ( SELECT MAX( sameentity.version ) FROM TypeEntity
> sameentity WHERE sameentity.id = :id ))] with parameters: {id=1011}

As far as I know the @Version property is only made for 
optimistic locking in a multiple user environment. This 
property should only be used by the JPA and you should leave 
it alone.

 > Column 'id' and 'version' are primary-key columns (and
 > getter methods are
 > tagged @Id)

To define the @Version property as a primary-key column is 
not a good idea I think. You should use a more common way 
for your primary-keys.

Markus

Mime
View raw message