{
ValueContainer[] result = new ValueContainer[fields.length];
for(int i = 0; i < fields.length; i++)
{
FieldDescriptor fd = fields[i];
Object cv = fd.getPersistentField().get(obj);
/*
handle autoincrement attributes if
- is a autoincrement field
- field represents a 'null' value, is nullified
and generate a new value
*/
if(fd.isAutoIncrement() && representsNull(fd, cv))
{
/*
setAutoIncrementValue returns a value that is
properly typed for the java-world. This value
needs to be converted to it's corresponding
sql type so that the entire result array contains
objects that are properly typed for sql.
*/
cv = setAutoIncrementValue(fd, obj, cv);
}
if(convertToSql)
{
// apply type and value conversion
cv = fd.getFieldConversion().javaToSql(cv);
}
// create ValueContainer
result[i] = new ValueContainer(cv, fd.getJdbcType());
}
return result;
}