entity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 1L);
Key key = ds.put(entity);
String keyStr = KeyFactory.keyToString(key);
beginTxn();
HasVersionJPA hv = em.find(clazz, keyStr);
hv.setValue("value");
commitTxn();
assertEquals(2L, hv.getVersion().longValue());
beginTxn();
hv = em.find(clazz, keyStr);
hv.setValue("a different value");
commitTxn();
assertEquals(3L, hv.getVersion().longValue());
// make sure the version gets bumped
entity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 4L);
beginTxn();
hv = em.find(clazz, keyStr);
hv.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();