entity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 1L);
Key key = ds.put(entity);
String keyStr = KeyFactory.keyToString(key);
beginTxn();
HasVersionWithFieldJDO hvwf = pm.getObjectById(HasVersionWithFieldJDO.class, keyStr);
hvwf.setValue("value");
commitTxn();
beginTxn();
hvwf = pm.getObjectById(HasVersionWithFieldJDO.class, keyStr);
assertEquals(2L, hvwf.getVersion());
// make sure the version gets bumped
entity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 3L);
hvwf.setValue("another value");
// we update the entity directly in the datastore right before commit
entity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 7L);
ds.put(entity);
try {
commitTxn();