You are not allowed to set the version manually. See the JPA spec section
An entity class may access the state of its version field or property or export a method which allows other user-written code to access the version, but user-written code must not directly modify the value of the version field or property of an entity instance after the entity is made persistent. [17] With the exception noted in Section 4.11, only the persistence provider is permitted to set or update the entity version. If the application does directly modify the value of the version field or property of an entity instance after it is made persistent, the behavior is undefined.
A version is generated by the JPA provider, so you should never set it.