public static void incrementVersion ( Object target ) { MetaClass metaClass = GroovySystem . getMetaClassRegistry ( ) . getMetaClass ( target . getClass ( ) ) ; if ( metaClass . hasProperty ( target , GormProperties . VERSION ) != null ) { Object version = metaClass . getProperty ( target , GormProperties . VERSION ) ; if ( version instanceof Long ) { Long newVersion = ( Long ) version + 1 ; metaClass . setProperty ( target , GormProperties . VERSION , newVersion ) ; } } }
Increments the entities version number in order to force an update