* Replace the complex objects with there ids.
*/
for(SqlParameterDefinition pd : definition.getManyToOneParameters().values()) {
if (pd.getObjectDefinition().isPresent()
&& pd.getObjectDefinition().get().getObjectDefintion().idParameter().isPresent()) {
SqlParameterDefinition idDef =
pd.getObjectDefinition().get().getObjectDefintion().idParameter().get();
NestedKeyValue<Object> nkv = ObjectMapUtils.getNestedKeyValue(m, pd.getParameterName(), idDef.getParameterName());
if (nkv.isPresent()) {
/*
* TODO: We only set it if the object is actually present. ie do you really want to set null?
*/
m.put(pd.getParameterName(), idDef.convertToSql(nkv.object));
}
else if (bulkInsert) {
//TODO default annotation perhaps here?
//http://stackoverflow.com/questions/197045/setting-default-values-for-columns-in-jpa
m.put(pd.getParameterName(), null);