*/
public UserUid createUidForUser(User user) {
Long userId = user.getId();
UserUid uid = appDao.findById(UserUid.class, userId);
if (uid != null) {
uid.setUid(generateNewUid());
appDao.updateProperty(uid, "uid", uid.getUid());
} else {
uid = new UserUid();
uid.setId(userId);
uid.setUid(generateNewUid());
// ID is not autogenerated, therefore it is created manually.
// Hence, we are calling save(), instead store().
appDao.save(uid);
}
return uid;