{
SqlDynaProperty[] properties = dynaClass.getSqlDynaProperties();
Collection result = CollectionUtils.select(Arrays.asList(properties), new Predicate() {
public boolean evaluate(Object input) {
SqlDynaProperty prop = (SqlDynaProperty)input;
if (bean.get(prop.getName()) != null)
{
// we ignore properties for which a value is present in the bean
// only if they are identity and identity override is off or
// the platform does not allow the override of the auto-increment
// specification
return !prop.getColumn().isAutoIncrement() ||
(isIdentityOverrideOn() && getPlatformInfo().isIdentityOverrideAllowed());
}
else
{
// we also return properties without a value in the bean
// if they ain't auto-increment and don't have a default value
// in this case, a NULL is inserted
return !prop.getColumn().isAutoIncrement() &&
(prop.getColumn().getDefaultValue() == null);
}
}
});
return (SqlDynaProperty[])result.toArray(new SqlDynaProperty[result.size()]);