{
if (m.getNumberOfDatastoreMappings() == 0 &&
(m instanceof PersistableMapping || m instanceof ReferenceMapping))
{
// Reachable Fields (that relate to this object but have no column in the table)
retrievedStatementMappings[fmd.getAbsoluteFieldNumber()] = new StatementMappingIndex(m);
int relationType = fmd.getRelationType(clr);
if (relationType == Relation.ONE_TO_ONE_BI)
{
if (fmd.getMappedBy() != null)
{
// 1-1 Non-owner bidirectional field (no datastore columns)
reachableFields.add(Integer.valueOf(fmd.getAbsoluteFieldNumber()));
}
}
else if (relationType == Relation.MANY_TO_ONE_BI)
{
AbstractMemberMetaData[] relatedMmds = fmd.getRelatedMemberMetaData(clr);
if (fmd.getJoinMetaData() != null || relatedMmds[0].getJoinMetaData() != null)
{
// N-1 bidirectional field using join (no datastore columns)
reachableFields.add(Integer.valueOf(fmd.getAbsoluteFieldNumber()));
}
}
// TODO What about 1-N non-owner
}
else
{
// Fields to be "inserted" (that have a datastore column)
// Check if the field is "insertable" (either using JPA column, or JDO extension)
if (fmd.hasExtension("insertable") && fmd.getValueForExtension("insertable").equalsIgnoreCase("false"))
{
return;
}
ColumnMetaData[] colmds = fmd.getColumnMetaData();
if (colmds != null && colmds.length > 0)
{
for (int i=0;i<colmds.length;i++)
{
if (!colmds[i].getInsertable())
{
// Not to be inserted
return;
}
}
}
int relationType = fmd.getRelationType(clr);
if (relationType == Relation.ONE_TO_ONE_BI)
{
if (fmd.getMappedBy() == null)
{
// 1-1 Owner bidirectional field using FK (in this table)
}
}
else if (relationType == Relation.MANY_TO_ONE_BI)
{
AbstractMemberMetaData[] relatedMmds = fmd.getRelatedMemberMetaData(clr);
if (fmd.getJoinMetaData() == null && relatedMmds[0].getJoinMetaData() == null)
{
// N-1 bidirectional field using FK (in this table)
relationFields.add(Integer.valueOf(fmd.getAbsoluteFieldNumber()));
}
}
statementMappings[fmd.getAbsoluteFieldNumber()] = new StatementMappingIndex(m);
// create the expressions index (columns index)
int parametersIndex[] = new int[m.getNumberOfDatastoreMappings()];
for (int j = 0; j < parametersIndex.length; j++)
{