// TODO:: Add support for Many-to-Many join tables.
String joinTableName = joinTableData.getJoinTableName();
String invJoinColumnName = joinTableData.getInverseJoinColumnName();
Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
joinTableData.getEntityClass());
// need to bring in an insert query for this
// add columns & execute query
CQLTranslator translator = new CQLTranslator();
String batch_Query = CQLTranslator.BATCH_QUERY;
String insert_Query = translator.INSERT_QUERY;
StringBuilder builder = new StringBuilder();
builder.append(CQLTranslator.DEFAULT_KEY_NAME);
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getJoinColumnName(), false));
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getInverseJoinColumnName(), false));
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMN_FAMILY,
translator.ensureCase(new StringBuilder(), joinTableName, false).toString());
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMNS, builder.toString());
StringBuilder columnValueBuilder = new StringBuilder();
StringBuilder statements = new StringBuilder();
// insert query for each row key and
for (Object key : joinTableRecords.keySet())
{
PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor((Field) entityMetadata
.getIdAttribute().getJavaMember());
Set<Object> values = joinTableRecords.get(key); // join column value
for (Object value : values)