keyVal = toString(idField, idVal);
break;
}
case AUTO_INCREMENT:
// manages String ID as not long!!!
throw new SienaRestrictedApiException("DB", "getItemName", "@Id AUTO_INCREMENT not supported by SDB");
case UUID:
{
Object idVal = Util.readField(obj, idField);
if(idVal == null){
UUID uuid = UUID.randomUUID();
keyVal = uuid.toString();
if(idField.getType() == UUID.class){
Util.setField(obj, idField, uuid);
}
else if(idField.getType() == String.class){
Util.setField(obj, idField, uuid.toString());
}
else {
throw new SienaRestrictedApiException("DB", "getItemName", "@Id UUID must be of type String or UUID");
}
}else {
keyVal = toString(idField, idVal);
}
break;
}
default:
throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
}
}
else throw new SienaException("Field " + idField.getName() + " is not an @Id field");
return keyVal;