• Post Reply Bookmark Topic Watch Topic
  • New Topic

version is not updated in JPA in case of named queries  RSS feed

Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I am using openjpa 2.1.0 implementation of JPA.
Where I have entity in that have property annotated with @Version annotation.

here XXX_VERSION is column in table with datatype numeric, now when I call merge by editing entity then openjpa will do increment value from XXX_VERSION column by 1.

Above functionality as expected, working absolutely fine.
But when I used a Named queries for updating some of the columns from table then version is not getting incremented due to that if any other concurrent user doing any thing with same row from DB from session of him then version is not got incremented in XXX_VERSION column.
I have tried to pass the incremented version to update query, it giving exception saying invalid query syntax.

what could be done so that version got incremented in case update queries using Named query?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!