Hi and ty Markus
The @Version tag is part of the EJB 3.0 spec (it's not JPA specific), which
also allows the use of @Id and @Version on the same field. As geronimo and
JPA are EJB 3.0 compliant, I'd expect this to work.
Of cause @Version is support for multi-user-environment, and of cause my
column named 'version' exactly handled this in a none-ejb-none-jpa
environment.
In the end, the specs leave the option to developer, wether to use @Version
or not.
1) In case I use @Version, I must not do changes to the 'version'
column/field on my own.
2) In case I don't use it, I have to manage version increments and checks on
my own.
When doing 1) I have to expect PersistenceExceptions due to failed
optimistic locking. (Two users did updates on the same Entity version.)
When doing 2) I have to expect my own management exceptions and/or SQL
Exceptions in case my management failed (mainly exceptions about key
violations...).
In either case I'd expect a failure of a query or a success but I'd not at
all expect it to fail in 1) and to succeed in 2) or the other way round.
> 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}
If the underlying sql works (and it does) there is no reason for me, why the
ejb Query should fail.
Notice: It fails with an ArrayOutOfBoundsException(!) (or something like
that)
Maybe I might have to accept a reasonable PersistenceException in turn!
Please correct me if my thoughts went wrong somewhere.
Ty
--
View this message in context:
http://www.nabble.com/%40Version-and-Query-using-version-column-cause-trouble--tp20642421s134p20649285.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.