I'm using Spring Roo 2.0.0.M3 with Spring Tool Suite 3.8.3. I've got a question about the "entity jpa" command. I used it to define a class that describes a MySql table. The table does not have a version column, but the entity jpa command forced me to use one. This is the command that I used:
entity jpa --class ~.domain.SFDCRecordTypeAccount --table sfdc_record_type_account --identifierColumn sfdc_record_type_account_id --versionField version --versionColumn version --versionType int --sequenceName sequenceName --identifierStrategy AUTO
Now I have a class that does not accurately reflect the MySql table. Is my only option to manually delete the version from the java code, or is there some way to remove it via Spring Roo?
By default, Spring Roo includes the version field to be able to manage the concurrency during entity edition. Is highly recommended to include this field to prevent loss of information during updates.
As I've said, Spring Roo includes it to prevent loss of information but if you don't need it, you could remove it from the .java
class directly.
So easily!
An other possible solution is to remove the @Version
annotation and include the @Transient
to ignore this field.
Anyway, I recommed you to use the generated field version
always.
Hope it helps,