superColumnName = ((AbstractAttribute) embeddableAttrib).getJPAColumnName()
+ Constants.EMBEDDED_COLUMN_NAME_DELIMITER + count;
if (m.isCounterColumnType())
{
CounterSuperColumn thriftSuperColumn = (CounterSuperColumn) buildThriftCounterSuperColumn(
m.getTableName(), superColumnName, superColumn, obj).get(m.getTableName());
tr.addCounterSuperColumn(thriftSuperColumn);
}
else
{
SuperColumn thriftSuperColumn = (SuperColumn) buildThriftSuperColumn(m.getTableName(),
superColumnName, timestamp2, superColumn, obj).get(m.getTableName());
tr.addSuperColumn(thriftSuperColumn);
}
ecCacheHandler.addElementCollectionCacheMapping(id, obj, superColumnName);
count++;
}
}
else
{
// Updation, Check whether this object is already in cache,
// which means we already have a super column
// Otherwise we need to generate a fresh embedded column
// name
int lastEmbeddedObjectCount = ecCacheHandler.getLastElementCollectionObjectCount(id);
for (Object obj : (Collection) superColumnObject)
{
superColumnName = ecCacheHandler.getElementCollectionObjectName(id, obj);
if (superColumnName == null)
{ // Fresh row
superColumnName = ((AbstractAttribute) embeddableAttrib).getJPAColumnName()
+ Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
}
Map<String, Object> thriftSuperColumn = buildThriftSuperColumn(timestamp2, m, id, superColumn,
superColumnName, obj);
if (m.isCounterColumnType())
{
tr.addCounterSuperColumn((CounterSuperColumn) thriftSuperColumn.get(m.getTableName()));
}
else
{
tr.addSuperColumn((SuperColumn) thriftSuperColumn.get(m.getTableName()));
}
ecCacheHandler.addElementCollectionCacheMapping(id, obj, superColumnName);
}
}
}