// This object needs to be queried using its primary key from the same
// PeristentManager object as the one that is going to persist it
userLivingStoryEntity = pm.getObjectById(
UserLivingStoryEntity.class, userLivingStoryEntity.getId());
userLivingStoryEntity.setLastVisitedTime(new Date());
userLivingStoryEntity.incrementVisitCount();
pm.makePersistent(userLivingStoryEntity);
} finally {
pm.close();
}
}