Iterator i = getAttributeProperties(changedObject, config).iterator();
ArrayList attributes = new ArrayList();
while (i.hasNext()) {
Property attr = (Property) i.next();
if (!table.isGeneratedColumnProperty(attr.getName())) {
attributes.add(attr.getName());
parameters.add(changedObject.getType().getProperty(
attr.getName()));
}
}
statement.append("(");
Iterator attrs = attributes.iterator();
while (attrs.hasNext()) {
String name = (String) attrs.next();
statement.append("");
statement.append(name);
if (attrs.hasNext())
statement.append(", ");
else
statement.append(")");
}
statement.append(" values (");
for (int idx = 1; idx <= attributes.size(); idx++) {
statement.append('?');
if (idx < attributes.size())
statement.append(", ");
else
statement.append(")");
}
InsertCommandImpl cmd = new InsertCommandImpl(statement.toString());
Iterator params = parameters.iterator();
for (int idx = 1; params.hasNext(); idx++) {
Property property = (Property) params.next();
Parameter p = new ParameterImpl();
p.setName(property.getName());
p.setType(property.getType());
p.setConverter(getConverter(table, property.getName()));
p.setIndex(idx);
cmd.addParameter(p);
}
DebugUtil.debugln(getClass(), debug, statement.toString());