Announcement Announcement Module
Collapse
No announcement yet.
version field added to entities Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • version field added to entities

    Why does roo add a "version" Integer column and field to entities? What's this used for?

  • #2
    It's for optimistic locking. If you attempt to commit some changes to an entity but it turns out someone else has updated that entity in the meantime (as indicated by the version number of your copy no longer matching that in the database), you can abort the transaction or possibly give the user a way of merging their changes with the previous changes. If you've ever used Bugzilla and had a "mid-air collision", this is an example of such a feature.

    Comment


    • #3
      Seems odd that roo forces this on us, my application has no use for this. So the version number is automatically incremented upon every edit?

      Comment


      • #4
        You can disable optimistic locking based on "version" field by using @RooEntity as follows:

        @RooEntity(versionField="")
        public class MyEntity {
        ...
        }

        HTH

        Comment

        Working...
        X