public void updated ( final UUID lastupdatedByEntityId ) { if ( this . entityId == null ) { throw new IllegalStateException ( "The entity has not yet been created : entityId == null" ) ; } Assert . notNull ( lastupdatedByEntityId , "lastupdatedByEntityId is required" ) ; entityVersion ++ ; updatedByEntityId = lastupdatedByEntityId ; entityUpdatedOn = System . currentTimeMillis ( ) ; }
Call this method when the entity is updated before it is persisted to increment its version and update its lastupdatedByEntityId