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)
{
if (value != null)
{
String insertQuery = insert_Query;
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(PropertyAccessorHelper.getString(key) + "\001"
+ PropertyAccessorHelper.getString(value));
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, key.getClass(), key, true, false);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, value.getClass(), value, true, false);
insertQuery = StringUtils.replace(insertQuery, CQLTranslator.COLUMN_VALUES,
columnValueBuilder.toString());
statements.append(insertQuery);
statements.append(" ");